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

Investigate how node-uuid is so fast #3

Closed
nelsonic opened this issue Feb 25, 2015 · 2 comments
Closed

Investigate how node-uuid is so fast #3

nelsonic opened this issue Feb 25, 2015 · 2 comments

Comments

@nelsonic
Copy link
Member

See: https://github.com/broofa/node-uuid/blob/master/benchmark/benchmark.js

Try it:

$ git clone https://github.com/broofa/node-uuid.git && cd node-uuid
$ npm install uuid uuid-js
$ node benchmark/benchmark.js

#### v4
nodeuuid.v4() - using node.js crypto RNG: 2840909 uuids/second
nodeuuid.v4() - using Math.random() RNG: 2747252 uuids/second
nodeuuid.v4('binary'): 2293577 uuids/second
nodeuuid.v4('binary', buffer): 2369668 uuids/second
uuid(): 171585 uuids/second
uuid('binary'): 162022 uuids/second
uuidjs.create(4): 433651 uuids/second
140byte.es_v4: 266951 uuids/second

#### v1
nodeuuid.v1(): 988142 uuids/second
nodeuuid.v1('binary'): 563063 uuids/second
nodeuuid.v1('binary', buffer): 851788 uuids/second
uuidjs.create(1): 320718 uuids/second
@nelsonic
Copy link
Member Author

Reading the history of the module is a good lesson in improving performance over time.
https://github.com/broofa/node-uuid/commits/master/uuid.js
I highly recommend it to anyone curious about high performance (but terse) JS.

@nelsonic
Copy link
Member Author

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

No branches or pull requests

1 participant