{"id":15713757,"url":"https://github.com/krthr/uuix","last_synced_at":"2026-02-24T07:05:08.688Z","repository":{"id":53766720,"uuid":"244051477","full_name":"krthr/uuix","owner":"krthr","description":"A tiny (\u003c1KB) and fast UUID (v4) generator for Crystal","archived":false,"fork":false,"pushed_at":"2021-08-17T00:06:22.000Z","size":27,"stargazers_count":19,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-10T08:11:23.904Z","etag":null,"topics":["crystal","crystal-language","mit","tiny","uuid","uuid4"],"latest_commit_sha":null,"homepage":"https://krthr.github.io/uuix/","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krthr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-29T22:35:29.000Z","updated_at":"2024-04-02T20:43:57.000Z","dependencies_parsed_at":"2022-09-11T16:10:25.990Z","dependency_job_id":null,"html_url":"https://github.com/krthr/uuix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krthr%2Fuuix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krthr%2Fuuix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krthr%2Fuuix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krthr%2Fuuix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krthr","download_url":"https://codeload.github.com/krthr/uuix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253830925,"owners_count":21971001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crystal","crystal-language","mit","tiny","uuid","uuid4"],"created_at":"2024-10-03T21:33:13.994Z","updated_at":"2026-02-24T07:05:08.596Z","avatar_url":"https://github.com/krthr.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# uuix\n\nA tiny (\u003c1KB) and fast UUID (v4) generator for Crystal\n\n\u003e This is the Crystal version of [@lukeed/uuid](https://github.com/lukeed/uuid)\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     uuix:\n       github: krthr/uuix\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"uuix\"\n\nputs UUIX.random # bc524cd7-5ec3-48c4-9bcc-e9013c69dd6e\n```\n\n## Benchmarks\n\nActual version:\n\n\u003e Using String.build (to optimize string generation). Proposed by [Sergey Kuznetsov](https://github.com/skuznetsov) in this [thread](https://forum.crystal-lang.org/t/a-tiny-1kb-fast-and-cryptographically-secure-uuid-v4-generator-for-crystal/1774/6)\n\n```bash\nCrystal 1.1.1 [6d9a1d583] (2021-07-26)\n\nLLVM: 10.0.1\nDefault target: x86_64-unknown-linux-gnu\n        UUIX:   2.71M (368.51ns) (± 9.29%)  321B/op        fastest\nCrystal UUID:   1.15M (867.45ns) (± 3.78%)  0.0B/op   2.35× slower\n```\n\nOriginal version:\n\n```bash\nCrystal 0.33.0 [612825a53] (2020-02-14)\n\nLLVM: 8.0.0\nDefault target: x86_64-unknown-linux-gnu\n        UUIX: 920.14k (  1.09µs) (± 9.68%)  880B/op        fastest\nCrystal UUID: 647.32k (  1.54µs) (± 7.53%)  0.0B/op   1.42× slower\n```\n\n## Performance\n\n\u003e Taken from https://github.com/lukeed/uuid\n\nThe reason why this UUID.V4 implementation is so much faster is two-fold:\n\n1. It composes an output with hexadecimal pairs (from a cached dictionary) instead of single characters.\n2. It allocates a larger Buffer/ArrayBuffer up front (expensive) and slices off chunks as needed (cheap).\n\nThe internal ArrayBuffer is 4096 bytes, which supplies **256** `random` invocations.\n\nA larger buffer would result in higher performance over time, but I found this to be a good balance of performance and memory space.\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/krthr/uuix/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [krthr](https://github.com/krthr) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrthr%2Fuuix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrthr%2Fuuix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrthr%2Fuuix/lists"}