Skip to content

delayed function loading causes heavy HDD usage #1865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mpmxyz opened this issue Jun 9, 2016 · 3 comments
Closed

delayed function loading causes heavy HDD usage #1865

mpmxyz opened this issue Jun 9, 2016 · 3 comments
Assignees

Comments

@mpmxyz
Copy link
Contributor

mpmxyz commented Jun 9, 2016

"delayloaded" functions are accessed via a lookup function stored at "lib/tools/delayLookup.lua".
Unfortunately the result is only stored in an internal cache but not in the library table.
That means the lookup function is called whenever the delayloaded function is accessed.
And since the lookup function is weakly stored it has to be reloaded every few calls.
That causes a lot of HDD accesses.

Examples
This shows the result is not stored in the library table:

lua
>=term.screen
function...
>=rawget(term, "screen")
nil

This causes a lot of HDD interaction:

local term = require("term")
local event = require("event")

while true do
 local e, s = event.pull(0.1)
 if s == term.screen().address then
  print("...")
 end
end

Since I didn't write the delayed loading stuff I'm not sure how to progress here. I could go ahead and modify lib/tools/delayLookup.lua to write to the library table. But I'd like to get someone else's opinion before I create a pull request.

@payonel
Copy link
Member

payonel commented Jun 9, 2016

I either want to keep it in the library table (e.g. term) or make the delay loader not weak. There are trade offs. I'll test some workflows, fix it, and tag this issue. Thanks for reporting.

@payonel
Copy link
Member

payonel commented Jun 13, 2016

@mpmxyz can you retest with >=1.6 beta 3? it should be fixed

@mpmxyz
Copy link
Contributor Author

mpmxyz commented Jun 15, 2016

The fix works. Thx

@fnuecke fnuecke closed this as completed Jun 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants