Use a seekless implementation of File:lines/love.filesystem.lines

The previous algorithm would seek every time. This meant that although reading
from a filesystem would be quick (especially with disk caching), but reading
from a zip would be extremely slow.

The new version is rouhgly as fast on a filesystem, but appears not to slow
down on zips at all. Not in my tests, at least.

--HG--
branch : minor
This commit is contained in:
Bart van Strien
2017-11-11 21:42:52 +01:00
parent d19129de5b
commit 19ddc27069
2 changed files with 81 additions and 76 deletions
+3 -1
View File
@@ -531,7 +531,9 @@ int w_lines(lua_State *L)
else
return luaL_argerror(L, 1, "expected filename.");
lua_pushcclosure(L, w_File_lines_i, 1);
lua_pushstring(L, ""); // buffer
lua_pushstring(L, 0); // buffer offset
lua_pushcclosure(L, w_File_lines_i, 3);
return 1;
}