bwmarrin / snowflake

A simple to use Go (golang) package to generate or parse Twitter snowflake IDs
BSD 2-Clause "Simplified" License
2.98k stars 371 forks source link

Optimize code #19

Closed nishaad78 closed 5 years ago

nishaad78 commented 5 years ago

Benchmark results:

Before:

BenchmarkGenerate-4                      5000000               311 ns/op               0 B/op          0 allocs/op
BenchmarkGenerateMaxSequence-4          20000000                66.9 ns/op             0 B/op          0 allocs/op

After:


BenchmarkGenerate-4                      5000000               243 ns/op               0 B/op          0 allocs/op
BenchmarkGenerateMaxSequence-4          20000000                66.6 ns/op             0 B/op          0 allocs/op