coercible icon indicating copy to clipboard operation
coercible copied to clipboard

Reduce usage of regexes for performance

Open tb0yd opened this issue 10 years ago • 5 comments

Some small performance enhancements.

coercible at performance branch:

Comparison:
Virtus: integer values for integer attributes        :    20948.6 i/s
Virtus: string values for integer attributes         :    18220.3 i/s - 1.15x slower
Virtus: string values for whatever attributes        :    18067.7 i/s - 1.16x slower
Virtus: without values                               :     9618.0 i/s - 2.18x slower

coercible at master branch:

Comparison:
Virtus: integer values for integer attributes        :    21541.2 i/s
Virtus: string values for whatever attributes        :    13354.4 i/s - 1.61x slower
Virtus: without values                               :    10314.2 i/s - 2.09x slower
Virtus: string values for integer attributes         :     3165.7 i/s - 6.80x slower
  • [x] Specs pass
Finished in 0.28534 seconds
396 examples, 0 failures

Benchmark code at: https://gist.github.com/tb0yd/79bc56683748605cff96

This benchmark is very simple & does not represent a realistic usage of Virtus. But the numbers are encouraging

tb0yd avatar Jan 15 '15 14:01 tb0yd

Thanks, I'm gonna update and cleanup devel/test setup so that build is passing in master, then could you merge master into your branch and then I could merge it, OK?

solnic avatar Jan 15 '15 17:01 solnic

Ok

tb0yd avatar Jan 15 '15 18:01 tb0yd

OK, I updated master

solnic avatar Jan 16 '15 11:01 solnic

BTW you could also check out another PR (that I must've missed for some reason :() that's related to performance

solnic avatar Jan 16 '15 11:01 solnic

I couldn't reproduce his findings

tb0yd avatar Jan 22 '15 14:01 tb0yd