hay / stapes

the Javascript MVC microframework that does just enough
http://hay.github.io/stapes
MIT License
443 stars 54 forks source link

makeUuid Speedup #56

Closed erichosick closed 10 years ago

erichosick commented 10 years ago
hay commented 10 years ago

Hi Erich, thanks for the pull request. Unfortunately, i really prefer understandable code over something that could gain performance. Would there be any chance of you trying to clean up the code to make it more readable?

Thanks.

erichosick commented 10 years ago

Sure Hay. Thought it would help some. I didn't write the algorithm I stole it from the same place the original algorithm stapes used came from: this https://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript. This is e7. I guess there is even a modularized version here: http://jcward.com/UUID.js .

There is a jsperf here: http://jsperf.com/uuid-generator-opt/4

I could reformat it, but felt it would be best to keep the original format because it is recognizable and a well thought out algorithm by the original author (Jeff Ward).