Skip to content

Conversation

zyuiop
Copy link
Contributor

@zyuiop zyuiop commented Sep 17, 2025

This PR adds a simple preemptive multi-threading feature, which automatically sets a timer to run the scheduler.reschedule() function at least once every 100us.

Known issues for now:

  • usleep does not work correctly in threads

@zyuiop zyuiop force-pushed the feat/preemptive-multithreads branch from 984b850 to 3198383 Compare September 17, 2025 08:44
@zyuiop zyuiop force-pushed the feat/preemptive-multithreads branch from 3198383 to 8875871 Compare September 17, 2025 08:51
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Results

Benchmark Current: 8875871 Previous: 40e0c6e Performance Ratio
startup_benchmark Build Time 135.85 s 136.14 s 1.00
startup_benchmark File Size 0.90 MB 0.90 MB 1.00
Startup Time - 1 core 0.91 s (±0.02 s) 0.94 s (±0.02 s) 0.98
Startup Time - 2 cores 0.92 s (±0.02 s) 0.92 s (±0.03 s) 1.01
Startup Time - 4 cores 0.93 s (±0.02 s) 0.96 s (±0.03 s) 0.97
multithreaded_benchmark Build Time 132.81 s 140.97 s 0.94
multithreaded_benchmark File Size 1.01 MB 1.01 MB 1.00
Multithreaded Pi Efficiency - 2 Threads 2.29 % (±11.01 %) 2.17 % (±10.40 %) 1.06
Multithreaded Pi Efficiency - 4 Threads 1.57 % (±7.52 %) 1.51 % (±7.26 %) 1.04
Multithreaded Pi Efficiency - 8 Threads 0.78 % (±3.74 %) 0.77 % (±3.68 %) 1.02
micro_benchmarks Build Time 163.41 s 171.42 s 0.95
micro_benchmarks File Size 1.01 MB 1.01 MB 1.00
Scheduling time - 1 thread 2.79 ticks (±13.39 ticks) 2.77 ticks (±13.29 ticks) 1.01
Scheduling time - 2 threads 1.32 ticks (±6.34 ticks) 1.75 ticks (±8.39 ticks) 0.76
Micro - Time for syscall (getpid) 0.16 ticks (±0.76 ticks) 0.12 ticks (±0.58 ticks) 1.31
Memcpy speed - (built_in) block size 4096 988.92 MByte/s (±4746.84 MByte/s) 1816.86 MByte/s (±8720.93 MByte/s) 0.54
Memcpy speed - (built_in) block size 1048576 732.96 MByte/s (±3518.22 MByte/s) 745.11 MByte/s (±3576.55 MByte/s) 0.98
Memcpy speed - (built_in) block size 16777216 225.44 MByte/s (±1082.13 MByte/s) 219.45 MByte/s (±1053.36 MByte/s) 1.03
Memset speed - (built_in) block size 4096 1224.49 MByte/s (±5877.55 MByte/s) 1875.00 MByte/s (±9000.00 MByte/s) 0.65
Memset speed - (built_in) block size 1048576 1002.93 MByte/s (±4814.08 MByte/s) 1029.20 MByte/s (±4940.18 MByte/s) 0.97
Memset speed - (built_in) block size 16777216 953.87 MByte/s (±4578.58 MByte/s) 924.64 MByte/s (±4438.25 MByte/s) 1.03
Memcpy speed - (rust) block size 4096 1165.05 MByte/s (±5592.23 MByte/s) 1411.76 MByte/s (±6776.47 MByte/s) 0.83
Memcpy speed - (rust) block size 1048576 679.20 MByte/s (±3260.15 MByte/s) 693.90 MByte/s (±3330.73 MByte/s) 0.98
Memcpy speed - (rust) block size 16777216 224.48 MByte/s (±1077.51 MByte/s) 219.67 MByte/s (±1054.40 MByte/s) 1.02
Memset speed - (rust) block size 4096 1395.35 MByte/s (±6697.67 MByte/s) 1791.04 MByte/s (±8597.01 MByte/s) 0.78
Memset speed - (rust) block size 1048576 990.30 MByte/s (±4753.42 MByte/s) 1105.00 MByte/s (±5304.01 MByte/s) 0.90
Memset speed - (rust) block size 16777216 933.61 MByte/s (±4481.34 MByte/s) 954.96 MByte/s (±4583.81 MByte/s) 0.98
alloc_benchmarks Build Time 158.76 s 157.27 s 1.01
alloc_benchmarks File Size 0.97 MB 0.97 MB 1.00
Allocations - Allocation success 2.00 % (±13.86 %) 2.00 % (±13.86 %) 1
Allocations - Deallocation success 1.40 % (±9.69 %) 1.40 % (±9.67 %) 1.00
Allocations - Pre-fail Allocations 2.00 % (±13.86 %) 2.00 % (±13.86 %) 1
Allocations - Average Allocation time 252.62 Ticks (±1750.57 Ticks) 262.62 Ticks (±1819.84 Ticks) 0.96
Allocations - Average Allocation time (no fail) 252.62 Ticks (±1750.57 Ticks) 262.62 Ticks (±1819.84 Ticks) 0.96
Allocations - Average Deallocation time 16.99 Ticks (±117.75 Ticks) 17.05 Ticks (±118.18 Ticks) 1.00
mutex_benchmark Build Time 161.78 s 159.65 s 1.01
mutex_benchmark File Size 1.01 MB 1.01 MB 1.00
Mutex Stress Test Average Time per Iteration - 1 Threads 0.32 ns (±2.22 ns) 0.36 ns (±2.49 ns) 0.89
Mutex Stress Test Average Time per Iteration - 2 Threads 0.40 ns (±2.77 ns) 0.38 ns (±2.63 ns) 1.05

This comment was automatically generated by workflow using github-action-benchmark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants