diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-04-10 11:01:50 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-04-10 11:01:53 +0200 |
commit | cc17dcae6df9247b32cbeeee59af677838d1b3f5 (patch) | |
tree | a1d44c1dc76c46ef7787b8d8e4cb8de5a694bd0d /src | |
parent | 2a802efe6456f8cfeda53b6df1201413e199812f (diff) | |
download | luaotfload-cc17dcae6df9247b32cbeeee59af677838d1b3f5.tar.gz |
[db] do not rely on __gc for font object lifetimes
The penalty for having font object closed automatically is huge: It
takes around nine seconds more to rebuild the font database: 58 s with
__gc, 49 s by closing manually. Even if it’s not the default, we
reintroduce the code for closing fonts manually to avoid that situation.
Diffstat (limited to 'src')
-rw-r--r-- | src/luaotfload-database.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index 7c5e69b..7d0c86b 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -60,6 +60,7 @@ fonts.handlers = fontshandlers local read_font_file = otfhandler.readers.getinfo local read_font_info = read_font_file +local close_font_file = function () end local gzipload = gzip.load local gzipsave = gzip.save @@ -1457,6 +1458,8 @@ ot_fullinfo = function (filename, return nil end + close_font_file (metadata) --> FF only + local rawinfo = get_raw_info (metadata, basename) local english_names = get_english_names (rawinfo) local namedata = organize_namedata (rawinfo, @@ -3425,9 +3428,11 @@ local use_fontforge = function (val) local fontloader = fontloader read_font_info = fontloader.info read_font_file = fontloader.open + close_font_file = fontloader.close else read_font_file = otfhandler.readers.getinfo read_font_info = read_font_file + close_font_file = function () end end end |