Skip to content
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

Benchmarks #2

Open
jz3xyz opened this issue Dec 14, 2019 · 3 comments
Open

Benchmarks #2

jz3xyz opened this issue Dec 14, 2019 · 3 comments

Comments

@jz3xyz
Copy link

jz3xyz commented Dec 14, 2019

For those interested, here are a few anecdotal benchmarks which suggest a slight improvement in using wasm-lz4 over lz4

bag lz4 wasm
129MB bag 14.16s 13.86s
129MB bag 14.72s 13.932s
129MB bag 14.14s 13.583s
801MB bag 1m31s 1m26s
801MB bag 1m28s 1m28s
801MB bag 1m28s 1m26s

lz4

    decompress: { lz4: buffer => Buffer.from(lz4.decompress(buffer)) },

wasm-lz4

    decompress: { lz4: decompress },

Hopefully, I'm not doing anything incorrectly to skew the numbers.
👍

@janpaul123
Copy link

Is this in the browser or in nodejs? Do you have a Github Gist or so of how you ran this? From what I remember the difference was much more dramatic, but I think that was mostly in the browser.

@jz3xyz
Copy link
Author

jz3xyz commented Dec 16, 2019

It's from nodejs version 12.11.1

node --version
v12.11.1

Code looks like this

const { open, TimeUtil } = require('rosbag')
const lz4 = require('lz4js')
const decompress = require('wasm-lz4')
const uuidv4 = require('uuid/v4')

const { performance } = require('perf_hooks');
const newTopics = []

// Begin Reading from Bag
const t0 = performance.now()
await bag.readMessages({
  topics: newTopics,
  decompress: { lz4: decompress },
}, result => {
  const { timestamp, message, topic } = result;
  // Convert message info to records
})
  .finally(() => { })
  .catch(err => { throw err })
const t1 = performance.now()
console.log(`[Converted] bag to X files in ${((t1 - t0) / 1000).toFixed(2)} seconds`)
//...

@janpaul123
Copy link

Ah that's still quite impressive since that library doesn't use any native extensions! 😮

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

No branches or pull requests

2 participants