lunarmodules / luafilesystem

LuaFileSystem is a Lua library developed to complement the set of functions related to file systems offered by the standard Lua distribution.
https://lunarmodules.github.io/luafilesystem/
MIT License
900 stars 291 forks source link

performance in windows of lfs.attributes inside lfs.dir loop #153

Open sonoro1234 opened 2 years ago

sonoro1234 commented 2 years ago

on https://github.com/sonoro1234/luafilesystem/ I did a performance comparision on windows between calling lfs.attibutes inside lfs.dir loop and a modified version of lfs.dir which returns file name but also a dir.entry which can be queried for file size and file mode. The performance increase was huge. (It was tested running a test that will recurse subdirectories from a hight level directory and was much slower in windows than in linux)

The change from https://github.com/sonoro1234/luafilesystem/ branch unicode is in commit https://github.com/sonoro1234/luafilesystem/commit/ba39e412a4a0da0179cca44a602378cb46988acb

The problem is that it breaks compability with https://github.com/keplerproject/luafilesystem

But the only breaking is that lfs.dir returns as always on linux/osx but on windows it returns the file name and also an object that can be queried for getting attributes. So that old use pattern is still possible but on windows you can also use the object if you need to increase performance.