weshatheleopard / rubyXL

Ruby lib for reading/writing/modifying .xlsx and .xlsm files
MIT License
1.27k stars 253 forks source link

Add `frozen_string_literal: true` #412

Closed ooooooo-q closed 2 years ago

ooooooo-q commented 2 years ago

I used memory_profiler to check where rubyXL was using a lot of memory, and fixed it.

Added frozen_string_literal: true to lib/ files. Testing seems to be fine, but depending on how users use the library, it may have an impact.

Result

rubyXL 3.4.20 (with Ruby 3.1.0)

frozen_string_literal

weshatheleopard commented 2 years ago

I do not believe these savings are significant. Besides, recent ruby automatically freezes literals (which caused issue fixed by 076ccdae048423bcb1bf31a459c5a1374378c20e)

ooooooo-q commented 2 years ago

I seem to remember that automatically freezes literals in ruby3 has been abandoned, but I may be mistaken. https://bugs.ruby-lang.org/issues/11473#note-53