money icon indicating copy to clipboard operation
money copied to clipboard

Enable frozen string literals

Open tagliala opened this issue 1 week ago • 0 comments

Hi,

I'm checking the effects of enabling frozen string literals on Money gem

The WIP is here: https://github.com/tagliala/money/pull/2

Money#format method is the one that will get the greater improvement

Test on M1 Pro, x86 Ruby, 3.3.2

Before

benchmark

                                     user     system      total        real
README Examples                  1.685944   0.001231   1.687175 (  1.689099)
Money#from_cents                 0.116858   0.000079   0.116937 (  0.117140)
Money#format                     1.157583   0.001087   1.158670 (  1.163761)

profile_memory

Total allocated: 280728 bytes (3531 objects)
Total retained:  800 bytes (8 objects)

allocated memory by gem
-----------------------------------
    268728  money/lib
     12000  other

After

benchmark

README Examples                  1.670620   0.001191   1.671811 (  1.675098)
Money#from_cents                 0.115541   0.000104   0.115645 (  0.115857)
Money#format                     1.133997   0.000903   1.134900 (  1.138368)

profile_memory

Total allocated: 265128 bytes (3171 objects)
Total retained:  800 bytes (8 objects)

allocated memory by gem
-----------------------------------
    253128  money/lib
     12000  other

tagliala avatar Jun 28 '24 07:06 tagliala