posts: micro-optimize allocations during thumbnail generation.

Do a few micro-optimizations to reduce the number of memory allocations
during thumbnail generation.

This commit, combined with freezing string literals in a7dc05 and
67b961, reduces the number of allocations on the front page from 180,000
to 150,000, and the number of retained objects from 8,000 to 4,000.
This commit is contained in:
evazion
2021-12-15 22:48:24 -06:00
parent 3fcecd59a8
commit 163ba8e7da
4 changed files with 14 additions and 15 deletions

View File

@@ -123,6 +123,6 @@ class PostPreviewComponent < ApplicationComponent
end
def has_sound?
post.has_tag?("sound")
is_animated? && post.has_tag?("sound")
end
end