Closed ashmaroli closed 5 years ago
Instead of coercing the env-var into a String, let us simply check if it is a non-empty String.
Every call to #render allocates 5 new "" just to check if it is empty:
#render
""
#host
#url
ENV["PAGES_AVATARS_URL"] == nil
ENV["PAGES_AVATARS_URL"].to_s
Thanks @ashmaroli!
You're welcome :smiley:
Summary
Instead of coercing the env-var into a String, let us simply check if it is a non-empty String.
Rationale
Every call to
#render
allocates 5 new""
just to check if it is empty:#host
is called at least 5 times per call to#render
via#url
.ENV["PAGES_AVATARS_URL"] == nil
, every call toENV["PAGES_AVATARS_URL"].to_s
allocates memory for a new""
.