Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/protonull/bunbufferconcatenationbenchmark
https://github.com/protonull/bunbufferconcatenationbenchmark
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/protonull/bunbufferconcatenationbenchmark
- Owner: Protonull
- License: gpl-3.0
- Created: 2024-06-14T04:52:38.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-06-14T05:23:21.000Z (6 months ago)
- Last Synced: 2024-06-14T06:35:08.632Z (6 months ago)
- Language: TypeScript
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BunBufferConcatenationBenchmark
Created this benchmark as I wanted to test a hunch. I was operating under the delusion that anything NodeJS is therefor
slow, that manual concatenation would be faster because that's how you do it in low[er]-level languages. Needless to say
I was completely wrong.## How to run
Clone this repo and execute `bun benchmark.ts`
## Results
```
cpu: AMD Ryzen 7 3700X 8-Core Processor
runtime: bun 1.1.13 (x64-linux)benchmark time (avg) (min … max)
----------------------------------------------------------------
• buffer-concat
----------------------------------------------------------------
Buffer.concat() 1'771 µs/iter (1'519 µs … 2'664 µs)
Uint8Array.set() 2'563 µs/iter (2'142 µs … 4'234 µs)
Uint8Array.from() 697 ms/iter (680 ms … 743 ms)
new Blob().arrayBuffer() 3'967 µs/iter (2'397 µs … 8'472 µs)summary for buffer-concat
Buffer.concat()
1.45x faster than Uint8Array.set()
2.24x faster than new Blob().arrayBuffer()
393.61x faster than Uint8Array.from()
```