Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ire4ever1190/anano
Another nanoID implementation for nim
https://github.com/ire4ever1190/anano
Last synced: 11 days ago
JSON representation
Another nanoID implementation for nim
- Host: GitHub
- URL: https://github.com/ire4ever1190/anano
- Owner: ire4ever1190
- License: mit
- Created: 2022-06-18T03:14:00.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-04T03:11:53.000Z (about 1 year ago)
- Last Synced: 2024-05-02T02:33:46.324Z (6 months ago)
- Language: Nim
- Size: 17.6 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
### Anano
Another nanoID implementation for Nim.This implementation is based off of [nim-neoid](https://github.com/theAkito/nim-neoid) but
- uses more compile time code to give massive speedups (This comes with the tradeoff though that you can't define options at runtime).
- Only uses the nim standard libraryWorks on `c`, `c++` and `js` backends
Main reason I built this was so I could learn how the ID was generated but also make it generate
an `array[byte]` instead so I could better store it in a database for another project of mine> **Warning**
> I am not a security expert and this has not be vetted. Use this at your own risk#### Usage
[docs](https://ire4ever1190.github.io/anano/anano.html)```nim
import ananolet id = genNanoID()
echo id
```#### Benchmarks
Time for generating 10000 elements
```
name ............................... min time avg time std dv runs
anano .............................. 9.276 ms 9.442 ms ±0.237 x525
nim-neoid ........................ 180.788 ms 186.523 ms ±7.320 x27
```
(From `benchmark.nim`, compiled with `-d:release`)