Commit 3a584f5
authored
feat: performance improvements log (#27)
* feat: add Dataflow vs NetTaskManagement benchmarks and optimize task cancellation logic
- Introduced `DataflowComparisonBenchmarks`:
- Compares NetTaskManagement and TPL Dataflow for starting, canceling, and processing N workers/items.
- Helps developers choose between tools based on specific use cases.
- Added details and execution instructions to `README.md`.
- Enhanced `CancelAllTasks()`:
- Introduced `CancelAllTasksParallelThreshold` for selective parallelization based on task count.
- Optimized logic for sequential vs parallel task cancellation to minimize overhead.
- Improved handling for completed tasks and cancellation token sources.
- Updated CI benchmark workflow to include the new comparison benchmarks.
- Extended documentation with detailed benchmark descriptions and updated example output.
Signed-off-by: Jose Luis Guerra Infante <sora_ryu@hotmail.com>
* feat: add unit tests for completed tasks and task cancellation edge cases
- Introduced `AlreadyCompletedTaskCheckTaskStatusCompleted_CompletedStatus` to validate handling of completed tasks in `CheckTaskStatusCompleted()`.
- Added `AllTasksInExceptListCancelAllTasks_TasksNotFoundToBeCancelledStatus` test to confirm behavior when all tasks are excluded from cancellation.
- Implemented `AlreadyCompletedTaskCancelAllTasks_AllTasksCancelPetitionAcceptedStatus` to verify cancellation behavior for already completed tasks.
Signed-off-by: Jose Luis Guerra Infante <sora_ryu@hotmail.com>
* feat: add internal visibility for parallel cancellation testing and new unit test
- Exposed `CancelAllTasksParallelThreshold` as `internal` to facilitate testing of parallel cancellation logic.
- Added `ParallelPathCancelAllTasks_AllTasksCancelPetitionAcceptedStatus` unit test to validate parallel task cancellation behavior with a reduced threshold.
- Modified project file to include `InternalsVisibleTo` for test assembly access.
Signed-off-by: Jose Luis Guerra Infante <sora_ryu@hotmail.com>
* feat: add unit tests for additional edge cases in `CancelAllTasks()`
- Added three new unit tests to validate behavior under diverse scenarios:
- `ParallelPathWithExceptListCancelAllTasks_AllTasksCancelPetitionAcceptedStatus`: Verifies cancellation of tasks excluding specific exceptions.
- `ParallelPathAlreadyCompletedTaskCancelAllTasks_AllTasksCancelPetitionAcceptedStatus`: Confirms behavior when all tasks are already completed.
- `ParallelPathAllTasksExceptedCancelAllTasks_TasksNotFoundToBeCancelledStatus`: Ensures correct status when all tasks are excluded from cancellation.
- Refactored `CancelAllTasks()` to remove redundant checks for `CancellationTokenSource`, improving code readability and maintainability.
Signed-off-by: Jose Luis Guerra Infante <sora_ryu@hotmail.com>
* feat: expand Dataflow vs NetTaskManagement benchmarks with detailed scenarios and threading model distinctions
- Enhanced `DataflowComparisonBenchmarks` with new benchmarking scenarios:
- Added separate benchmarks for `LongRunning` and `Pool` task creation options.
- Introduced `ParallelBlockingWork` benchmark to measure throughput for blocking workloads.
- Implemented `CancelWaitDeleteAll()` to ensure proper teardown of tasks in benchmarks.
- Detailed threading model trade-offs for different task behaviors (e.g., high-throughput anonymous items vs long-running dedicated workers).
- Improved clarity with updated benchmark naming and comments:
- Split benchmarks to explicitly track `LongRunning` vs `Pool` configurations.
- Expanded documentation of benchmarks' purpose, implementation, and tradeoffs.
- Updated iteration setup and cleanup logic to support task type distinctions.
- Ensured accurate benchmarking by accounting for thread-pool injection delays in `ParallelBlockingWork`.
Signed-off-by: Jose Luis Guerra Infante <sora_ryu@hotmail.com>
* feat: improve logging for task completion checks in `TasksManagement`
- Updated `_logger.LogDebug` to use structured logging with placeholders, improving log clarity and parameterization.
- Replaced interpolated string with structured log format for better log analysis and performance.
Signed-off-by: Jose Luis Guerra Infante <sora_ryu@hotmail.com>
* feat: update `README.md` with threading model benchmarks and usage guidance
- Added detailed descriptions of `LongRunning` vs `None` threading models, including performance trade-offs.
- Enhanced benchmark comparison for blocking workloads and thread-pool behavior.
- Updated `DataflowComparisonBenchmarks` with expanded scenarios and threading distinctions.
Signed-off-by: Jose Luis Guerra Infante <sora_ryu@hotmail.com>
---------
Signed-off-by: Jose Luis Guerra Infante <sora_ryu@hotmail.com>1 parent 8ae5113 commit 3a584f5
2 files changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
135 | 138 | | |
136 | 139 | | |
137 | 140 | | |
138 | | - | |
| 141 | + | |
139 | 142 | | |
140 | 143 | | |
141 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
0 commit comments