zulip/static
Steve Howell 3cc6ff5480 templates: Cache translations.
For Manage Streams, when we render the subscriptions
template, a significant amount of time is taken
by the "t" helper.

Obviously for the first call, we expect "t" to be
somewhat expensive, but subsuquent calls should be
fast, but i18next seems to have some overhead.
Also, we can save a tiny bit of overhead (marking it
as a safe string) that comes from our helper.

As an aside, are we sure it's ok to mark translations
as safe strings?

To test before and after, use blueslip.timings before
and after this commit.  When I tested with about 300
streams, the difference is pretty striking:

    without cache: 100ms
    with cache: 20ms

This is particularly interesting, since the subscriptions
templates have long strings for things like the SVG-based
checkmarks, but they're not really the bottleneck.

Unfortunately, this doesn't seem to be a huge win
elsewhere.  In some places we don't call "t", but of
course those might change in the future and benefit from
the cache.  And in other places we have smart widgets
that avoid rendering all N objects at one (e.g. buddy
list and list_render).

So this might be too big a hammer to speed up one
screen (albeit a really slow one).  It's possible
that we should simply move the i18n.t step **outside**
of certain templates to avoid doing them in a loop.
2020-01-15 18:01:59 -08:00
..
assets styles: Finish removing manual antialiasing configuration. 2019-08-30 14:51:52 -07:00
audio notifications: Add a setting for changing the notification sound. 2018-12-09 21:25:30 -08:00
generated
html 5xx.html: Build with webpack. 2019-10-28 15:53:15 -07:00
images integrations: Add Gitea integration. 2019-11-18 11:55:24 -08:00
js templates: Cache translations. 2020-01-15 18:01:59 -08:00
shared js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
styles default stream groups: Fix broken registration UI. 2020-01-14 14:50:18 -08:00
templates org settings: Use save/discard widget for notification stream settings. 2020-01-14 17:16:23 -08:00
third dependencies: Remove WebSockets system for sending messages. 2020-01-14 22:34:00 -08:00
.gitignore generate-custom-icon-webfont: Replace with webpack webfonts-loader. 2019-07-18 12:00:00 -07:00
favicon.ico