4 ms·
That is definitely taking the long way around.... Why not just grab a timestamp and base32 it yourself? ULIDs also use millisecond timestamps, and use implement
by dahfizz 4y ago
That is definitely taking the long way around.... Why not just grab a timestamp and base32 it yourself? ULIDs also use millisecond timestamps, and use implementation magic to sort IDs within a millisecond. If you are just using the timestamp portion, you should use micro or nanoseconds.
- kortex 4y agoWell yeah that's kind of what I mean. On some libraries you can generate and encode just the timestamp part.
- dahfizz 4y agoIts literally one line of code, let slug = base32Encode( window.performance.now() ) Maybe 15 LoC if you don't want to import a b32 encoder. Hardly seems worth a dependency.