mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Cache: Rewrite based on lua-lru
Ought to be faster than our naive array-based approach. Especially for the glyph cache, which has a solid amount of elements, and is mostly cache hits. (There are few things worse for performance in Lua than table.remove @ !tail and table.insert @ !tail, which this was full of :/). DocCache: New module that's now an actual Cache instance instead of a weird hack. Replaces "Cache" (the instance) as used across Document & co. Only Cache instance with on-disk persistence. ImageCache: Update to new Cache. GlyphCache: Update to new Cache. Also, actually free glyph bbs on eviction.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
describe("Koptinterface module", function()
|
||||
local DocumentRegistry, Koptinterface, Cache
|
||||
local DocCache, DocumentRegistry, Koptinterface
|
||||
setup(function()
|
||||
require("commonrequire")
|
||||
DocCache = require("document/doccache")
|
||||
DocumentRegistry = require("document/documentregistry")
|
||||
Koptinterface = require("document/koptinterface")
|
||||
Cache = require("cache")
|
||||
end)
|
||||
|
||||
local tall_pdf = "spec/front/unit/data/tall.pdf"
|
||||
@@ -19,7 +19,7 @@ describe("Koptinterface module", function()
|
||||
doc.configurable.text_wrap = 0
|
||||
complex_doc.configurable.text_wrap = 0
|
||||
paper_doc.configurable.text_wrap = 0
|
||||
Cache:clear()
|
||||
DocCache:clear()
|
||||
end)
|
||||
|
||||
after_each(function()
|
||||
|
||||
Reference in New Issue
Block a user