SgtPooki / fast-write-atomic

Fast way to write a file atomically, for Node.js
MIT License
0 stars 0 forks source link

windows testing #1

Open SgtPooki opened 9 months ago

SgtPooki commented 9 months ago

test clustering and benchmark on windows. the below was a crappy little MSI Modern 14 windows machine:

Running suite for string content
┌─────────┬────────────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │             Task Name              │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼────────────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │    'string - write-file-atomic'    │  '264'  │ 3774773.999094963  │ '±1.27%' │  1000   │
│    1    │    'string - fast-write-atomic'    │  '324'  │ 3077599.099636078  │ '±1.47%' │  1000   │
│    2    │       'string - atomically'        │  '278'  │ 3593763.6984586716 │ '±1.44%' │  1000   │
│    3    │          'string - steno'          │  '543'  │ 1840023.201584816  │ '±1.58%' │  1000   │
│    4    │ 'string - @sgtpooki/steno-patched' │  '530'  │ 1885375.598192215  │ '±2.63%' │  1000   │
│    5    │     'string - steno-custom.js'     │  '509'  │ 1962581.2007188797 │ '±0.59%' │  1000   │
└─────────┴────────────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘

Running suite for Buffer content
┌─────────┬────────────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │             Task Name              │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼────────────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │    'Buffer - write-file-atomic'    │  '279'  │ 3574479.0031909943 │ '±7.16%' │  1000   │
│    1    │    'Buffer - fast-write-atomic'    │  '394'  │ 2537017.597436905  │ '±1.65%' │  1000   │
│    2    │       'Buffer - atomically'        │  '317'  │ 3154312.597155571  │ '±1.33%' │  1000   │
│    3    │          'Buffer - steno'          │  '848'  │ 1178639.6020650864 │ '±3.60%' │  1000   │
│    4    │ 'Buffer - @sgtpooki/steno-patched' │  '863'  │ 1158331.4980268478 │ '±2.50%' │  1000   │
│    5    │     'Buffer - steno-custom.js'     │  '684'  │ 1461177.2981882095 │ '±3.35%' │  1000   │
└─────────┴────────────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘

Running suite for Uint8Array content
┌─────────┬────────────────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │               Task Name                │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼────────────────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │    'Uint8Array - write-file-atomic'    │  '294'  │ 3399550.798177719  │ '±1.38%' │  1000   │
│    1    │    'Uint8Array - fast-write-atomic'    │  '397'  │ 2518433.1996440887 │ '±1.64%' │  1000   │
│    2    │       'Uint8Array - atomically'        │  '317'  │ 3146675.8979558945 │ '±1.54%' │  1000   │
│    3    │          'Uint8Array - steno'          │  '872'  │ 1146788.6031866074 │ '±1.18%' │  1000   │
│    4    │ 'Uint8Array - @sgtpooki/steno-patched' │  '884'  │  1131194.80073452  │ '±1.56%' │  1000   │
│    5    │     'Uint8Array - steno-custom.js'     │  '720'  │ 1388687.0000362396 │ '±0.47%' │  1000   │
└─────────┴────────────────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘

Running suite for Uint16Array content
┌─────────┬─────────────────────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │                  Task Name                  │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼─────────────────────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │ 'Uint16Array - write-file-atomic - INVALID' │  '338'  │ 2950408.2013368607 │ '±1.83%' │  1000   │
│    1    │      'Uint16Array - fast-write-atomic'      │  '392'  │ 2550208.799123764  │ '±2.18%' │  1000   │
│    2    │    'Uint16Array - atomically - INVALID'     │  '355'  │ 2814434.6998929977 │ '±1.34%' │  1000   │
│    3    │            'Uint16Array - steno'            │  '870'  │ 1148942.7992105484 │ '±1.28%' │  1000   │
│    4    │   'Uint16Array - @sgtpooki/steno-patched'   │  '857'  │  1165652.89580822  │ '±2.66%' │  1000   │
│    5    │       'Uint16Array - steno-custom.js'       │  '722'  │ 1383253.099679947  │ '±0.46%' │  1000   │
└─────────┴─────────────────────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘

Running suite for Uint32Array content
┌─────────┬─────────────────────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │                  Task Name                  │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼─────────────────────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │ 'Uint32Array - write-file-atomic - INVALID' │  '362'  │ 2761177.002429962  │ '±1.08%' │  1000   │
│    1    │      'Uint32Array - fast-write-atomic'      │  '389'  │ 2566812.6969337463 │ '±2.60%' │  1000   │
│    2    │    'Uint32Array - atomically - INVALID'     │  '389'  │ 2565735.4012727737 │ '±1.14%' │  1000   │
│    3    │            'Uint32Array - steno'            │  '883'  │ 1132271.0016965866 │ '±0.91%' │  1000   │
│    4    │   'Uint32Array - @sgtpooki/steno-patched'   │  '888'  │ 1125453.201174736  │ '±0.78%' │  1000   │
│    5    │       'Uint32Array - steno-custom.js'       │  '727'  │ 1373754.4997930527 │ '±0.43%' │  1000   │
└─────────┴─────────────────────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘

Running suite for DataView content
┌─────────┬──────────────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │              Task Name               │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼──────────────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │    'DataView - write-file-atomic'    │  '297'  │ 3363471.9014167786 │ '±1.24%' │  1000   │
│    1    │    'DataView - fast-write-atomic'    │  '398'  │ 2507996.7000484467 │ '±1.71%' │  1000   │
│    2    │       'DataView - atomically'        │  '296'  │ 3370212.7010822296 │ '±9.22%' │  1000   │
│    3    │          'DataView - steno'          │  '859'  │ 1163512.200832367  │ '±1.15%' │  1000   │
│    4    │ 'DataView - @sgtpooki/steno-patched' │  '878'  │ 1138228.4027338028 │ '±1.29%' │  1000   │
│    5    │     'DataView - steno-custom.js'     │  '724'  │ 1380157.699227333  │ '±0.47%' │  1000   │
└─────────┴──────────────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘

Running suite for Iterable content
┌─────────┬──────────────────────────────────────┬─────────┬───────────────────┬──────────┬─────────┐
│ (index) │              Task Name               │ ops/sec │ Average Time (ns) │  Margin  │ Samples │
├─────────┼──────────────────────────────────────┼─────────┼───────────────────┼──────────┼─────────┤
│    0    │          'Iterable - steno'          │ '1,275' │ 784184.1027736664 │ '±0.59%' │  1000   │
│    1    │ 'Iterable - @sgtpooki/steno-patched' │ '1,251' │ 798933.2988262177 │ '±0.53%' │  1000   │
│    2    │     'Iterable - steno-custom.js'     │  '935'  │ 1068559.500336647 │ '±0.44%' │  1000   │
└─────────┴──────────────────────────────────────┴─────────┴───────────────────┴──────────┴─────────┘

Running suite for AsyncIterable content
┌─────────┬───────────────────────────────────────────┬─────────┬───────────────────┬──────────┬─────────┐
│ (index) │                 Task Name                 │ ops/sec │ Average Time (ns) │  Margin  │ Samples │
├─────────┼───────────────────────────────────────────┼─────────┼───────────────────┼──────────┼─────────┤
│    0    │          'AsyncIterable - steno'          │ '1,299' │ 769270.3026533127 │ '±0.51%' │  1000   │
│    1    │ 'AsyncIterable - @sgtpooki/steno-patched' │ '1,259' │ 794255.1004886627 │ '±0.54%' │  1000   │
│    2    │     'AsyncIterable - steno-custom.js'     │  '928'  │ 1076941.101193428 │ '±0.54%' │  1000   │
└─────────┴───────────────────────────────────────────┴─────────┴───────────────────┴──────────┴─────────┘

Running suite for Stream content
┌─────────┬────────────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │             Task Name              │ ops/sec │ Average Time (ns)  │  Margin  │ Samples │
├─────────┼────────────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│    0    │          'Stream - steno'          │  '816'  │ 1224973.6994504929 │ '±1.60%' │  1000   │
│    1    │ 'Stream - @sgtpooki/steno-patched' │  '808'  │ 1236399.5010852814 │ '±2.19%' │  1000   │
│    2    │     'Stream - steno-custom.js'     │  '714'  │ 1398729.3026447296 │ '±0.42%' │  1000   │
└─────────┴────────────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘
SgtPooki commented 9 months ago
PS C:\Users\sgtpo\code\foss\SgtPooki\fast-write-atomic> node .\test-cluster-write.mjs
Primary 16860 has started.
Worker 16648 has started.
Worker 17268 has started.
Worker 16716 has started.
Worker 16628 has started.
Worker 13080 has started.
Worker 15592 has started.
Worker 17376 has started.
Worker 964 has started.
Worker 11752 has started.
Worker 9176 has started.
Worker 17236 has started.
Worker 15628 has started.
Worker 8280 has started.
Worker 8752 has started.
Worker 11384 has started.
Worker 11232 has started.
testing write of large string of length 107487

testing fwaWrite..worker 17268 threw an error when trying to write file with fwaWrite
.worker 16628 threw an error when trying to write file with fwaWrite
.worker 17376 threw an error when trying to write file with fwaWrite
...worker 17236 threw an error when trying to write file with fwaWrite
worker 15628 threw an error when trying to write file with fwaWrite
.......worker 16628 threw an error when trying to write file with fwaWrite
..worker 17376 threw an error when trying to write file with fwaWrite
.worker 11752 threw an error when trying to write file with fwaWrite
worker 15592 threw an error when trying to write file with fwaWrite
...worker 8280 threw an error when trying to write file with fwaWrite
......worker 16716 threw an error when trying to write file with fwaWrite
..worker 11752 threw an error when trying to write file with fwaWrite
.worker 964 threw an error when trying to write file with fwaWrite
worker 8280 threw an error when trying to write file with fwaWrite
worker 17236 threw an error when trying to write file with fwaWrite
.worker 15628 threw an error when trying to write file with fwaWrite
.worker 11384 threw an error when trying to write file with fwaWrite

file contents mismatch for fwaWrite
expected test-data-11384-9xpc...
got test-data-11232-9xpc...

testing stenoWrite...worker 16628 threw an error when trying to write file with stenoWrite
........worker 8280 threw an error when trying to write file with stenoWrite
worker 8752 threw an error when trying to write file with stenoWrite
.worker 11232 threw an error when trying to write file with stenoWrite
worker 16716 threw an error when trying to write file with stenoWrite
.worker 16628 threw an error when trying to write file with stenoWrite
......worker 17236 threw an error when trying to write file with stenoWrite
worker 9176 threw an error when trying to write file with stenoWrite
..worker 8752 threw an error when trying to write file with stenoWrite
.worker 11232 threw an error when trying to write file with stenoWrite
worker 16628 threw an error when trying to write file with stenoWrite
.............worker 11232 threw an error when trying to write file with stenoWrite
.
file contents mismatch for stenoWrite
expected test-data-11384-9xpc...
got test-data-11232-9xpc...

testing customStenoWrite................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
testing manualWrite................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
testing manualWriteFd................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Primary 16860 is exiting.
The following write functions failed concurrent write test:
         * fwaWrite
         * stenoWrite