-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add compression algorithm benchmarks #271
Comments
SGTM |
I'm not sure this is going to work. I added a import { fileURLToPath } from 'node:url'
import fs from 'node:fs'
import zlib from 'node:zlib'
import { createBenchmarkSuite } from '../common.mjs'
const fixturePath = fileURLToPath(
new URL('./fixtures/words_dictionary.json.gz', import.meta.url)
)
let fixtureData = fs.readFileSync(fixturePath)
fixtureData = zlib.gunzipSync(fixtureData)
const suite = createBenchmarkSuite('Compression algorithms')
suite
.add('Deflate', function () {
zlib.deflateSync(fixtureData)
})
.add('Gzip', function () {
zlib.gzipSync(fixtureData)
})
await suite.runAndPrintResults() With the fixture data coming from https://github.com/dwyl/english-words/blob/master/words_dictionary.json (I The result is always:
I don't think that's giving a useful result. But I could be setting up the benchmark incorrectly. |
Right, for this kind of operation, I believe a time-based benchmark would work better. Example: https://github.com/RafaelGSS/nodejs-bench-operations/blob/main/bench/array-append.mjs |
Thanks. I'll look into that. |
I think it would be helpful to include benchmarks for the common compression algorithms that
zlib
supports. In particular, I would like to see the comparison betweendeflate
andgzip
. Some sort of "large" JSON representation should be used for the test. https://github.com/matthewreagan/WebstersEnglishDictionary/blob/master/dictionary.json may be too large, but something at least a couple of megabytes.The text was updated successfully, but these errors were encountered: