Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ioq benchmarking and performance improvements #149

Merged
merged 14 commits into from
Dec 3, 2024
Merged

ioq benchmarking and performance improvements #149

merged 14 commits into from
Dec 3, 2024

Conversation

tavianator
Copy link
Owner

Benchmark results

Complete traversal

linux v6.5 (86,380 files)

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/linux -false 22.0 ± 3.0 18.9 31.3 1.00
bfs-main bench/corpus/linux -false 22.9 ± 3.8 19.4 35.0 1.04 ± 0.22

rust 1.72.1 (192,714 files)

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/rust -false 54.3 ± 3.0 50.1 61.0 1.00
bfs-main bench/corpus/rust -false 57.1 ± 3.8 52.4 64.5 1.05 ± 0.09

chromium 119.0.6036.2 (2,119,292 files)

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/chromium -false 464.9 ± 6.4 459.2 480.4 1.00
bfs-main bench/corpus/chromium -false 503.7 ± 8.7 489.9 522.8 1.08 ± 0.02

Early termination

chromium 119.0.6036.2 (depth 24)

Depth 2

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/chromium -name $(shuf -n1 $FILES) -print -quit 9.9 ± 2.0 6.1 14.0 1.00
bfs-main bench/corpus/chromium -name $(shuf -n1 $FILES) -print -quit 10.0 ± 1.5 7.9 13.0 1.02 ± 0.25

Depth 4

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/chromium -name $(shuf -n1 $FILES) -print -quit 29.7 ± 5.1 22.4 37.0 1.10 ± 0.38
bfs-main bench/corpus/chromium -name $(shuf -n1 $FILES) -print -quit 26.9 ± 8.2 17.8 42.4 1.00

Depth 8

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/chromium -name $(shuf -n1 $FILES) -print -quit 176.7 ± 15.7 156.1 200.6 1.00
bfs-main bench/corpus/chromium -name $(shuf -n1 $FILES) -print -quit 208.1 ± 16.5 178.0 224.5 1.18 ± 0.14

Depth 16

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/chromium -name $(shuf -n1 $FILES) -print -quit 484.9 ± 8.1 476.9 500.1 1.00
bfs-main bench/corpus/chromium -name $(shuf -n1 $FILES) -print -quit 529.4 ± 34.1 510.3 624.9 1.09 ± 0.07

Traversal with stat()

rust 1.72.1 (192,714 files)

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/rust -size 1024G 402.0 ± 28.0 343.3 447.3 1.00
bfs-main bench/corpus/rust -size 1024G 428.7 ± 36.1 393.4 488.5 1.07 ± 0.12

Printing paths

Without colors

linux v6.5

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/linux 45.8 ± 3.6 40.0 53.5 1.00
bfs-main bench/corpus/linux 46.0 ± 4.2 39.7 53.6 1.00 ± 0.12

With colors

linux v6.5

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/linux -color 206.0 ± 10.6 182.0 226.0 1.00
bfs-main bench/corpus/linux -color 213.6 ± 6.8 201.0 223.1 1.04 ± 0.06

Search strategies

rust 1.72.1

-S bfs

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -S bfs bench/corpus/rust -false 91.9 ± 5.8 83.7 111.0 1.00
bfs-main -S bfs bench/corpus/rust -false 95.6 ± 3.3 89.0 102.1 1.04 ± 0.08

-S dfs

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -S dfs bench/corpus/rust -false 92.9 ± 5.1 84.9 102.4 1.00
bfs-main -S dfs bench/corpus/rust -false 94.3 ± 4.5 87.0 102.3 1.02 ± 0.07

-S ids

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -S ids bench/corpus/rust -false 912.3 ± 12.0 889.8 933.8 1.00
bfs-main -S ids bench/corpus/rust -false 945.3 ± 16.9 917.5 970.6 1.04 ± 0.02

-S eds

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -S eds bench/corpus/rust -false 205.6 ± 4.8 198.0 214.6 1.00
bfs-main -S eds bench/corpus/rust -false 223.4 ± 8.5 213.0 243.5 1.09 ± 0.05

Parallelism

rust 1.72.1

-j1

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -j1 bench/corpus/rust -false 187.4 ± 2.5 184.1 192.2 1.05 ± 0.05
bfs-main -j1 bench/corpus/rust -false 177.8 ± 8.9 169.6 192.2 1.00

-j2

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -j2 bench/corpus/rust -false 124.4 ± 5.6 117.4 136.5 1.00
bfs-main -j2 bench/corpus/rust -false 131.0 ± 5.9 124.5 147.8 1.05 ± 0.07

-j3

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -j3 bench/corpus/rust -false 101.6 ± 5.1 94.7 111.1 1.00
bfs-main -j3 bench/corpus/rust -false 105.5 ± 1.6 103.3 109.1 1.04 ± 0.05

-j4

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -j4 bench/corpus/rust -false 76.5 ± 1.7 73.5 79.9 1.00
bfs-main -j4 bench/corpus/rust -false 76.8 ± 3.1 68.4 81.8 1.00 ± 0.05

-j6

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -j6 bench/corpus/rust -false 60.4 ± 4.1 53.1 71.2 1.00
bfs-main -j6 bench/corpus/rust -false 60.8 ± 3.1 54.6 67.3 1.01 ± 0.09

-j8

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -j8 bench/corpus/rust -false 55.2 ± 3.9 49.3 64.8 1.00
bfs-main -j8 bench/corpus/rust -false 57.1 ± 3.2 52.3 64.8 1.04 ± 0.09

-j12

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -j12 bench/corpus/rust -false 54.8 ± 5.1 49.1 70.3 1.00
bfs-main -j12 bench/corpus/rust -false 58.5 ± 4.6 51.6 67.0 1.07 ± 0.13

-j16

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop -j16 bench/corpus/rust -false 57.3 ± 4.6 50.5 68.0 1.00
bfs-main -j16 bench/corpus/rust -false 68.1 ± 6.3 56.7 80.0 1.19 ± 0.14

Process spawning

linux v6.5

One file per process

Command Mean [s] Min [s] Max [s] Relative
bfs-ioq-nop bench/corpus/linux -maxdepth 2 -exec true -- {} \; 1.598 ± 0.046 1.530 1.662 1.00
bfs-main bench/corpus/linux -maxdepth 2 -exec true -- {} \; 1.628 ± 0.058 1.518 1.704 1.02 ± 0.05

Many files per process

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-ioq-nop bench/corpus/linux -exec true -- {} + 79.4 ± 3.7 72.3 88.2 1.00
bfs-main bench/corpus/linux -exec true -- {} + 82.9 ± 3.1 75.0 90.1 1.04 ± 0.06

Spawn in parent directory

Command Mean [s] Min [s] Max [s] Relative
bfs-ioq-nop bench/corpus/linux -maxdepth 3 -execdir true -- {} + 1.306 ± 0.019 1.282 1.334 1.00
bfs-main bench/corpus/linux -maxdepth 3 -execdir true -- {} + 1.315 ± 0.025 1.269 1.351 1.01 ± 0.02

Details

Versions

$ bfs-ioq-nop --version | head -n1
bfs 4.0.4-29-gdb4eb23
$ bfs-main --version | head -n1
bfs 4.0.4-16-gaecdabb

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 65.78947% with 91 lines in your changes missing coverage. Please review.

Project coverage is 74.34%. Comparing base (aecdabb) to head (b4ce4d6).
Report is 14 commits behind head on main.

Files with missing lines Patch % Lines
src/ioq.c 72.58% 39 Missing and 12 partials ⚠️
src/bfstd.c 38.46% 15 Missing and 1 partial ⚠️
src/xtime.c 50.00% 12 Missing and 3 partials ⚠️
src/sighook.c 37.50% 3 Missing and 2 partials ⚠️
build/has/pthread-setname-np.c 0.00% 2 Missing ⚠️
src/bftw.c 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #149      +/-   ##
==========================================
- Coverage   74.60%   74.34%   -0.27%     
==========================================
  Files          89       90       +1     
  Lines       10523    10661     +138     
  Branches     2035     2066      +31     
==========================================
+ Hits         7851     7926      +75     
- Misses       1801     1852      +51     
- Partials      871      883      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tavianator tavianator force-pushed the ioq-nop branch 2 times, most recently from d591c08 to 95313df Compare December 3, 2024 19:30
Also, cache-align struct ioq_ent to avoid false sharing when two workers
are handling neighbouring requests.
This helps avoid situations where multiple waiters block on different
slots using the same monitor, which happened more often than expected
due to correlations caused by batching.
The new ioq_submit() function is now necessary to call to ensure the
pending request batch is flushed.
@tavianator tavianator merged commit b4ce4d6 into main Dec 3, 2024
17 checks passed
@tavianator tavianator deleted the ioq-nop branch December 3, 2024 22:05
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.

1 participant