mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 17:52:45 +08:00

Calling `Emoji.tonable_emojis` fetches from the cache but creates a giant array each time it is called. ``` MemoryProfiler.report { Emoji.unicode_replacements }.pretty_print ``` Before: ``` Total allocated: 16560770 bytes (246364 objects) Total retained: 784793 bytes (10624 objects) allocated memory by gem ----------------------------------- 10224581 activesupport-4.2.8 3504241 hiredis-0.6.1 1449466 discourse/app 679314 2.4.1/lib 419592 discourse/lib 226720 redis-3.3.3 56680 activerecord-4.2.8 176 thread_safe-0.3.6 ``` After: ``` Total allocated: 2127703 bytes (30556 objects) Total retained: 798099 bytes (10735 objects) allocated memory by gem ----------------------------------- 1270762 discourse/app 690149 2.4.1/lib 106977 bootsnap-1.0.0 48764 activesupport-4.2.8 5266 logster-1.2.7 2473 hiredis-0.6.1 2056 redis-3.3.3 840 discourse/lib 240 activerecord-4.2.8 176 thread_safe-0.3.6 ```