Open schneems opened 1 month ago
Thanks for the report. I will look into it.
I haven't looked at the speed of the gem in a long time. It was faster in the early days of this gem for most common formats. But given all of the Ruby perf work in recent years, it's time I reviewed that.
These days I use it mainly for it's format flexibility. But a memory blow out is no good, so I'd be keen to fix that.
Cool, thanks for your work! It's not urgent for me, I'm not blocked. I just thought you might want to know 💜
Thanks for the gem. I was looking for an alternative to Time that was faster and used less memory. I can't speak to the speed, but using the
memory_profiler
gem I found that this uses considerably more allocations thanTime.parse
.Here's an example string that I'm parsing:
Here's the
memory_profiler
top level allocations for the app I'm profiling, before withTime.parse
:After with Timeliness:
Reproduction
You can see this with an example script:
Thoughts
It seems that on the first allocation that
Time.parse
uses more memory, but on subsequent parsesTimeliness.parse
uses more. Perhaps there is some memorization trick that Time.parse is using to reduce memory that could also be used here.