diff options
author | Eric Wong <e@yhbt.net> | 2020-05-08 01:59:01 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-05-09 00:55:25 +0000 |
commit | dc7dc9ef49e3d396d2b47fa2befd1718aff45f0d (patch) | |
tree | fb35ed078a60c1f7654a8677bc9299f69f97b4bf /lib/PublicInbox/WWW.pm | |
parent | b714ab45d30d6f0298d73ef4281c1d0263a02493 (diff) | |
download | public-inbox-dc7dc9ef49e3d396d2b47fa2befd1718aff45f0d.tar.gz |
Encode lazy-loads encodings on an as-needed basis. This is great for short-lived programs, but leads to fragmentation in long-lived daemons where immortal allocations can get interleaved with short-lived, per-request allocations. Since we have no idea which encodings will be needed when there's a constant flow of incoming mail, just preload everything available at startup.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r-- | lib/PublicInbox/WWW.pm | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 275e509f..3a428218 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -141,6 +141,12 @@ sub call { # fragmentation since common allocators favor a large contiguous heap. sub preload { my ($self) = @_; + + # populate caches used by Encode internally, since emails + # may show up with any encoding. + require Encode; + Encode::find_encoding($_) for Encode->encodings(':all'); + require PublicInbox::ExtMsg; require PublicInbox::Feed; require PublicInbox::View; |