Skip to content

Instantly share code, notes, and snippets.

@hugosenari
Last active September 8, 2023 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hugosenari/45580bea0a476a095e82ea06a5adb841 to your computer and use it in GitHub Desktop.
Save hugosenari/45580bea0a476a095e82ea06a5adb841 to your computer and use it in GitHub Desktop.
Malebolgia PR19 vs SpinLocks
OP T0E0 T0E1 T1E0 T1E1 T2E0 T0E1-T0E0 T1E0-T0E1
count 100 100 100 100 100 100 100 100
mean 88 60161 60196 83309 83346 119640 35 23149
std 49 158756 158759 203086 203090 301369 17 67967
min 42 1238 1267 3385 3412 5622 23 866
25% 60 5089 5118 10852 10882 16680 25 2020
50% 73 13457 13485 23656 23685 30790 30 4886
75% 94 32269 32302 55943 55978 94389 38 13003
max 295 999287 999349 1570617 1570679 2244872 128 571330
OP T0E0 T0E1 T1E0 T1E1 T2E0 T0E1-T0E0 T1E0-T0E1
count 100 100 100 100 100 100 100 100
mean 173 2048 2106 3223 3279 4781 57 1173
std 40 1282 1294 1288 1295 1287 22 726
min 88 1287 1343 2122 2173 3467 41 -1300
25% 169 1576 1629 2714 2766 4271 50 845
50% 187 1821 1874 3000 3055 4673 54 1165
75% 197 2114 2162 3386 3442 5042 56 1571
max 257 013718 013880 0014854 0014966 0016138 207 03338
OP T0E0 T0E1 T1E0 T1E1 T2E0 T0E1-T0E0 T1E0-T0E1
count 100 100 100 100 100 100 100 100
mean 210 2255 2313 3591 3649 5289 58 1336
std 54 1237 1243 1233 1237 1424 17 764
min 117 1378 1430 2163 2209 3927 44 -1974
25% 155 1745 1799 3052 3120 4596 51 932
50% 239 1961 2037 3470 3525 5153 55 1353
75% 244 2440 2494 3948 4001 5585 56 1760
max 397 013010 013137 0014354 0014455 0016794 154 003478
OP T0E0 T0E1 T1E0 T1E1 T2E0 T0E1-T0E0 T1E0-T0E1
count 100 100 100 100 100 100 100 100
mean 135 11760 11809 12959 13011 13705 48 1201
std 56 5461 5463 5470 5473 5594 16 1027
min 94 5315 5360 5817 5862 6139 42 -43
25% 97 6560 6626 7725 7771 8831 44 456
50% 122 11841 11885 13812 13856 13913 46 762
75% 160 15922 15968 16996 17042 17839 47 1356
max 516 034203 034247 0034124 0034204 0037187 197 004607
@Araq
Copy link

Araq commented Sep 8, 2023

Btw I cannot read these tables. What is OP T0E0 etch?

@hugosenari
Copy link
Author

hugosenari commented Sep 8, 2023

Sorry, It was defined in the last one:
https://gist.github.com/hugosenari/dbc33d833593e3b21eb83299295580b1#methodology

We run 5 operations in 3 threads to make sure we have the following scenarios

  • OP: Now-EPOCH
  • T0E0: First element in the first thread after EPOCH, initial scenario
  • T0E1: Second element in the first thread after EPOCH, serial scenario
  • T1E0: First element in the second thread after EPOCH, parallel scenario
  • T1E1: Second element in the second thread after EPOCH, parallel serial scenario
  • T2E0: First element in the third thread after EPOCH, odd parallel scenario
echo [
  "OP",
  "T0E0",
  "T0E1",
  "T1E0",
  "T1E1",
  "T2E0",
  "T0E1-T0E0",
  "T1E0-T0E1",
].join(sep)
var ops = [getMonoTime(), getMonoTime(), getMonoTime(), getMonoTime(), getMonoTime()]
for i in 0..runs:
  let bigbang = getMonoTime()
  let epoch   = getMonoTime()
  parMap ops, 2, now
  echo [
    $inNanoseconds(epoch  - bigbang),
    $inNanoseconds(ops[0] - epoch),
    $inNanoseconds(ops[1] - epoch),
    $inNanoseconds(ops[2] - epoch),
    $inNanoseconds(ops[3] - epoch),
    $inNanoseconds(ops[4] - epoch),
    $inNanoseconds(ops[1] - ops[0]),
    $inNanoseconds(ops[3] - ops[1]),
  ].join(sep)

Those number has EPOCH inside parMap (now parApply) to reduce createMaster/waitAll noise
https://github.com/Araq/malebolgia/pull/22/files#diff-ba1bc4fc97f1cf143e30ffeca1e08d14fd8dabde039082b21face559f972f47dR35

@hugosenari
Copy link
Author

We have that third thread to make sure that second one goes into the same branch of first one here

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment