[chore] FileChooser: "traditional" for loop for ~15-25% better performance (#5827)

Apparently there's less overhead this way.

See https://github.com/koreader/koreader/pull/5819 for context.
This commit is contained in:
Frans de Jonge
2020-02-08 11:45:26 +01:00
committed by GitHub
parent 1177baaf01
commit 6dfe65279c

View File

@@ -242,7 +242,8 @@ function FileChooser:genItemTableFromPath(path)
-- otherwise, show new files in bold
local show_file_in_bold = G_reader_settings:readSetting("show_file_in_bold")
for _, file in ipairs(files) do
for i = 1, #files do
local file = files[i]
local full_path = self.path.."/"..file.name
local file_size = lfs.attributes(full_path, "size") or 0
local sstr = getFriendlySize(file_size)