I’ve started implementation of one feature for this gem, and found interesting spec tests.
For example some serialization methods should work at least 25 times faster than AMS. Interesting case!
After some investigation, I found for example - what simple call :symbol.to_s.pluralize takes a lot of time, and broke some test cases.
So, I decided to sort it out, and added some benchmarks.
My current ruby version:
Let’s start from string and this benchmark. Concatenation works faster, because we just modify existing string object.
Without creation temp string object as for example for “+” operation.
Interesting and obvious thing here - when we use directly same data structure, code runs faster.
You can read about bang! methods here.
When we trying to access instance variable, it works about two times faster!
Accessor methods are too slow.
Last interesting thing in this post - parallel assigment. Yep - it’s slow :)