Skip to content

Async I/O queue#100

Merged
tavianator merged 6 commits intomainfrom
ioq
Jun 13, 2023
Merged

Async I/O queue#100
tavianator merged 6 commits intomainfrom
ioq

Conversation

@tavianator
Copy link
Copy Markdown
Owner

@tavianator tavianator commented Jun 12, 2023

See #101.

Performance

Performance is a work-in-progress; not every optimization from #101 is implemented yet. Here's a quick summary of the results so far:

  • 9dca9f2 (eval: Pre-allocate the highest fd) saves hundreds of ms in some cases
  • Complete traversal is already ~40% faster on large trees
  • Early termination can be quite a bit faster (3-11x), though with higher variance
  • Cold cache searches are also much faster (~40%)
  • Depth-first search is quite a bit slower (3.8x)
    • Fixed: it helps to actually do any parallelism at all in depth-first mode ;)
Full benchmark results

Complete traversal

Small tree

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-main ~/code/bfs/history -false 4.2 ± 2.5 1.5 9.0 2.45 ± 2.38
bfs-ioq~2 ~/code/bfs/history -false 63.7 ± 11.6 36.7 95.2 37.44 ± 29.75
bfs-ioq~1 ~/code/bfs/history -false 5.0 ± 2.6 2.6 12.3 2.96 ± 2.74
bfs-ioq ~/code/bfs/history -false 1.7 ± 1.3 0.7 8.2 1.00

Medium tree

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-main ~/code/linux -false 65.9 ± 10.0 57.5 102.2 1.17 ± 0.27
bfs-ioq~2 ~/code/linux -false 248.3 ± 44.1 190.2 318.8 4.40 ± 1.10
bfs-ioq~1 ~/code/linux -false 86.1 ± 12.5 70.9 113.3 1.53 ± 0.35
bfs-ioq ~/code/linux -false 56.4 ± 9.9 44.3 74.9 1.00

Large tree

Command Mean [s] Min [s] Max [s] Relative
bfs-main ~/code/android -false 1.128 ± 0.032 1.091 1.192 1.42 ± 0.08
bfs-ioq~2 ~/code/android -false 1.563 ± 0.070 1.444 1.680 1.97 ± 0.12
bfs-ioq~1 ~/code/android -false 1.350 ± 0.055 1.283 1.433 1.70 ± 0.10
bfs-ioq ~/code/android -false 0.792 ± 0.035 0.739 0.851 1.00

Early termination

Shallow file

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-main ~/code/android -name ConstClassBenchmark.java -quit 129.6 ± 11.6 120.7 156.2 1.00
bfs-ioq~2 ~/code/android -name ConstClassBenchmark.java -quit 694.8 ± 586.9 179.3 1711.8 5.36 ± 4.55
bfs-ioq~1 ~/code/android -name ConstClassBenchmark.java -quit 364.9 ± 257.8 27.9 694.6 2.82 ± 2.01
bfs-ioq ~/code/android -name ConstClassBenchmark.java -quit 135.0 ± 162.7 14.8 802.8 1.04 ± 1.26

Medium file

Command Mean [s] Min [s] Max [s] Relative
bfs-main ~/code/android -name DominatorsComputation.java -quit 1.098 ± 0.023 1.073 1.141 11.41 ± 18.21
bfs-ioq~2 ~/code/android -name DominatorsComputation.java -quit 0.435 ± 0.324 0.259 1.276 4.52 ± 7.97
bfs-ioq~1 ~/code/android -name DominatorsComputation.java -quit 0.469 ± 0.482 0.080 1.067 4.87 ± 9.24
bfs-ioq ~/code/android -name DominatorsComputation.java -quit 0.096 ± 0.154 0.042 0.942 1.00

Deep file

Command Mean [s] Min [s] Max [s] Relative
bfs-main ~/code/android -name TestSidecarCompat.java -quit 1.351 ± 0.023 1.314 1.392 3.07 ± 1.98
bfs-ioq~2 ~/code/android -name TestSidecarCompat.java -quit 0.886 ± 0.562 0.262 1.587 2.01 ± 1.82
bfs-ioq~1 ~/code/android -name TestSidecarCompat.java -quit 0.501 ± 0.412 0.093 1.403 1.14 ± 1.19
bfs-ioq ~/code/android -name TestSidecarCompat.java -quit 0.441 ± 0.285 0.084 0.846 1.00

Search strategies

dfs

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-main -S dfs ~/code/linux -false 72.8 ± 13.5 60.3 101.8 1.34 ± 0.37
bfs-ioq~2 -S dfs ~/code/linux -false 100.7 ± 44.5 67.6 262.4 1.85 ± 0.90
bfs-ioq~1 -S dfs ~/code/linux -false 90.7 ± 11.6 70.5 112.0 1.67 ± 0.41
bfs-ioq -S dfs ~/code/linux -false 54.5 ± 11.4 37.0 75.5 1.00

ids

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-main -S ids ~/code/linux -false 358.5 ± 18.9 343.1 404.0 1.40 ± 0.08
bfs-ioq~2 -S ids ~/code/linux -false 612.4 ± 19.1 588.8 647.3 2.38 ± 0.09
bfs-ioq~1 -S ids ~/code/linux -false 440.1 ± 15.2 425.6 469.8 1.71 ± 0.07
bfs-ioq -S ids ~/code/linux -false 257.0 ± 6.0 247.5 264.4 1.00

eds

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-main -S eds ~/code/linux -false 139.8 ± 10.5 117.6 158.6 1.41 ± 0.22
bfs-ioq~2 -S eds ~/code/linux -false 319.5 ± 17.2 285.1 350.0 3.22 ± 0.47
bfs-ioq~1 -S eds ~/code/linux -false 159.0 ± 12.9 140.5 186.7 1.60 ± 0.25
bfs-ioq -S eds ~/code/linux -false 99.1 ± 13.3 79.3 135.5 1.00

Cold cache

Command Mean [ms] Min [ms] Max [ms] Relative
bfs-main ~/code/linux -false 96.1 ± 9.3 86.0 110.8 1.39 ± 0.24
bfs-ioq~2 ~/code/linux -false 243.6 ± 40.2 197.2 337.4 3.51 ± 0.76
bfs-ioq~1 ~/code/linux -false 99.9 ± 11.9 85.4 121.6 1.44 ± 0.27
bfs-ioq ~/code/linux -false 69.4 ± 9.8 54.1 80.2 1.00

@codecov

This comment was marked as outdated.

@tavianator tavianator force-pushed the ioq branch 2 times, most recently from 0afa621 to cc923a7 Compare June 12, 2023 18:07
@tavianator tavianator mentioned this pull request Jun 12, 2023
24 tasks
@tavianator tavianator force-pushed the ioq branch 2 times, most recently from 1ff1d21 to 8e509d4 Compare June 12, 2023 20:44
Parallelism is controlled by the new -j flag.
This avoids the need to grow the fd table during the search,
significantly reducing kernel contention when opening directories in
parallel.
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