gorhill / cronexpr

Cron expression parser in Go language (golang)
687 stars 169 forks source link

Improve performance where obvious #6

Closed gorhill closed 10 years ago

gorhill commented 11 years ago

Current benchmarking results on Kernel Linux 3.5.0-17-generic i5-3570K:

BenchmarkParse   50000    42706 ns/op
BenchmarkNext   100000    18948 ns/op

For fields which commonly default to "*", it should be worth to avoid constructing array of valid values.

gorhill commented 11 years ago

Latest commits:

BenchmarkParse   50000    38468 ns/op
BenchmarkNext   100000    20446 ns/op
gorhill commented 11 years ago

Latest commit:

BenchmarkParse   50000    38031 ns/op
BenchmarkNext   200000     8890 ns/op
gorhill commented 11 years ago

09aefb5f32b5e0d6d22a8894611dd4f04a19019d:

BenchmarkParse   50000    38110 ns/op
BenchmarkNext   200000     8538 ns/op