Nic Lin's Blog

喜歡在地上打滾的 Rails Developer

為什麼 ruby constant 要 freeze

為什麼 ruby constant 要 freeze

https://waynechu.cc/posts/146-ruby-constant-freeze

every where 不論 rack / rails 都會這樣做

https://stackoverflow.com/questions/27702540/why-are-there-frozen-constants-everywhere

https://www.honeybadger.io/blog/when-to-use-freeze-and-frozen-in-ruby/ https://ruby-china.org/topics/19925 Reducing object allocations

https://www.mikeperham.com/2018/02/28/ruby-optimization-with-one-magic-comment/

參考這個 PR

https://github.com/mperham/sidekiq/pull/3759

comments powered by Disqus