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

hashid #1

Closed
pjebs opened this issue May 3, 2015 · 7 comments
Closed

hashid #1

pjebs opened this issue May 3, 2015 · 7 comments

Comments

@pjebs
Copy link

pjebs commented May 3, 2015

Is this quicker than hashid (using an all-number alphabet)?

http://hashids.org/

@pjebs
Copy link
Author

pjebs commented May 3, 2015

Also it is called Knuth's integer hash (not Kunth)

@jenssegers
Copy link
Owner

Wow, what a typo!

I don't think this method will be any slower than hashids. If you take a look at the Optimus class you wil see that the technique is super simple. I will do a benchmark soon, but performance won't be an issue ;)

@jenssegers
Copy link
Owner

These are the results for a simple benchmark that simply constructs both classes and then encodes and decodes an id for 100.000 times:

  • Optimus: 452ms
  • Hashids: 57.680s

@pjebs
Copy link
Author

pjebs commented May 7, 2015

Converted your code to go: https://github.com/pjebs/optimus-go

@pjebs
Copy link
Author

pjebs commented Jun 18, 2015

@pjebs
Copy link
Author

pjebs commented Jun 18, 2015

Expect more traffic

@jenssegers
Copy link
Owner

Cool!

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

No branches or pull requests

2 participants