Skip to content

LFound/cpp-task-processing-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High-Performance Task Processing Engine (C++)

A performance-focused C++ project exploring how implementation choices affect computational cost when processing large numbers of tasks.

This project compares two task-processing pipelines:

  • Naive implementation using dynamic allocations and pointer indirection
  • Optimized implementation using contiguous storage and cache-friendly data layout

The goal is to demonstrate how memory layout and allocation strategy influence throughput and processing efficiency.


Overview

Many systems that process large workloads — schedulers, pipelines, simulators, and runtime engines — depend heavily on how data is structured in memory.

Even when the logical workload is identical, different implementation strategies can result in substantial performance differences.

This project provides a simple experimental framework for measuring those effects.


What This Project Demonstrates

  • Allocation overhead vs contiguous storage
  • Pointer indirection vs direct memory access
  • Cache locality effects
  • Throughput differences from implementation strategy
  • Benchmark discipline and reproducible measurement

Implementations Compared

Naive Engine

  • Heap allocation per task
  • Pointer-based storage
  • Less cache-friendly memory access

Optimized Engine

  • Contiguous task storage
  • Fewer allocations
  • Cache-friendly iteration
  • Reduced indirection overhead

Benchmark Setup

Benchmarks process multiple task counts:

  • 100,000 tasks
  • 500,000 tasks
  • 1,000,000 tasks

Each test runs multiple iterations to improve timing stability.

Metrics recorded:

  • Total processing time
  • Relative speedup

Example Results

Speedups of ~3–5x observed depending on workload size.

This illustrates how implementation mechanics can significantly affect system performance.


Example Outputs

Processing Time Comparison

Processing Time Comparison

Speedup by Task Count

Speedup by Task Count


Project Structure

cpp-task-processing-engine/
├── include/
│ └── task_engine.hpp
├── src/
│ ├── main.cpp
│ └── task_engine.cpp
├── scripts/
│ └── plot_results.py
├── results/
│ ├── benchmark_results.csv
│ ├── processing_time_comparison.png
│ └── speedup_by_task_count.png
└── README.md

Build & Run

Compile

g++ -O2 -std=c++17 src/*.cpp -Iinclude -o engine_benchmark

Run Benchmarks

./engine_benchmark

Generate Plots

python scripts/plot_results.py

Run Full Benchmark Pipeline

./scripts/run_benchmarks.sh

Why This Matters

In performance-sensitive systems such as:

  • Schedulers
  • Simulators
  • Data pipelines
  • High-throughput services

Implementation choices can significantly influence computational cost.

Understanding these tradeoffs is essential for building efficient systems.


Future Extensions

Possible next steps:

  • Multithreaded processing
  • Custom allocator experiments
  • Cache-line alignment tests
  • Lock-free data structures
  • Profiling and flamegraph analysis

License

MIT

About

C++ performance project comparing naive and optimised task-processing pipelines to study computational cost, memory layout and throughput differences.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors