Title: ulid() slow vs monotonic · Issue #126 · ulid/javascript · GitHub
Open Graph Title: ulid() slow vs monotonic · Issue #126 · ulid/javascript
X Title: ulid() slow vs monotonic · Issue #126 · ulid/javascript
Description: Does it make sense that ulid() is so slow relative to monothonic? I ran this simple benchmark multiple times to test this library vs uuidv7, and it always returns around the same results: import { ulid, monotonicFactory } from 'ulid'; fu...
Open Graph Description: Does it make sense that ulid() is so slow relative to monothonic? I ran this simple benchmark multiple times to test this library vs uuidv7, and it always returns around the same results: import { ...
X Description: Does it make sense that ulid() is so slow relative to monothonic? I ran this simple benchmark multiple times to test this library vs uuidv7, and it always returns around the same results: import { ...
Opengraph URL: https://github.com/ulid/javascript/issues/126
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ulid() slow vs monotonic","articleBody":"Does it make sense that ulid() is so slow relative to monothonic?\nI ran this simple benchmark multiple times to test this library vs uuidv7, and it always returns around the same results:\n\n```import { v7 as uuidv7 } from 'uuid';\nimport { ulid, monotonicFactory } from 'ulid';\n\nfunction bench(name, fn, N = 5_000_000) {\n // warmup\n for (let i = 0; i \u003c 200_000; i++) fn();\n const t0 = performance.now();\n for (let i = 0; i \u003c N; i++) fn();\n const t1 = performance.now();\n console.log(`${name}: ${(N / ((t1 - t0) / 1000)).toFixed(1)} ids/sec`);\n}\n\nbench('uuidv7', uuidv7);\nbench('ulid', ulid);\nbench('ulid(monotonic)', monotonicFactory());\n```\n\nThe results\n```\nuuidv7: 5486105.0 ids/sec\nulid: 31140.8 ids/sec\nulid(monotonic): 2054127.8 ids/sec\n```\n\nwhy is ulid() much slower than monotonic? and why is monotonic slower than uuidv7?","author":{"url":"https://github.com/atlanteh","@type":"Person","name":"atlanteh"},"datePublished":"2025-09-12T14:34:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/126/javascript/issues/126"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3c008638-cd32-a3df-e472-4a5b65deed20 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 97A2:14C488:79D8:9E8A:698E63BD |
| html-safe-nonce | 34d69d1868cb2c156a217f99ad40fd46528be4c14994b5c3c25f29d0d6c6cd6c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0EyOjE0QzQ4ODo3OUQ4OjlFOEE6Njk4RTYzQkQiLCJ2aXNpdG9yX2lkIjoiODUwNzM3ODAxMjMwNzQ4MTUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ce57f6050c07a1e94ded5f1a2306bc3c1e0014003e6b1bfd600166e7abd73cef |
| hovercard-subject-tag | issue:3410754179 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ulid/javascript/126/issue_layout |
| twitter:image | https://opengraph.githubassets.com/139680d6cc328f68fad323ebbfbd2f79f9c9e6c6ccf5097cefdb0d81618c0183/ulid/javascript/issues/126 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/139680d6cc328f68fad323ebbfbd2f79f9c9e6c6ccf5097cefdb0d81618c0183/ulid/javascript/issues/126 |
| og:image:alt | Does it make sense that ulid() is so slow relative to monothonic? I ran this simple benchmark multiple times to test this library vs uuidv7, and it always returns around the same results: import { ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | atlanteh |
| hostname | github.com |
| expected-hostname | github.com |
| None | 666e30cc1de8ebdf458084bf731e95deba4f074a5008f91b50803aa9a71e3725 |
| turbo-cache-control | no-preview |
| go-import | github.com/ulid/javascript git https://github.com/ulid/javascript.git |
| octolytics-dimension-user_id | 33265518 |
| octolytics-dimension-user_login | ulid |
| octolytics-dimension-repository_id | 61051155 |
| octolytics-dimension-repository_nwo | ulid/javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 61051155 |
| octolytics-dimension-repository_network_root_nwo | ulid/javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c5daa44975c44e187dd9ea0d761c37973489d508 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width