-
Notifications
You must be signed in to change notification settings - Fork 19
Rework luacontroller memory, disk #134
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
Conversation
it should result in less overall computation in editor and main sandbox. But unfortunately, without luajit optimizations this doesn't work. (see next commits) extras: - modified the basic editor to use the new API. - added some quality of life extras to basic editor. - updated help page about memory, disk and links.
Notably, these functions also 'escapes' from libox's time tracking. This might be dangerous, but it's unlikely to cause problems... (famous words i'm sure)
please don't do this, it feels pointless |
mods/sbz_logic/env.lua
Outdated
| return libf(function(...) | ||
| local hook = {debug.gethook()} | ||
| debug.sethook() | ||
| jit.on(true, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so apparently you can do jit.on(func, true) instead, i think that's a better solution
jit.off also flushes away any optimizations
- Fix serializer not working for tables - Have write_disk() report bad disk data
Back to using libf/sandbox_lib_f
|
is this merge-able or are you still working on it |
|
oh i forgot to say that. it's ready for merge/review. |
|
hmm i should review this |
TheEt1234
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just needs a few changes
- sbz now (primarily) uses LuaJIT - luacontroller read_disk() and write_disk() now checks for NaN - typo fix
- don't escape terminal_text twice when rendering formspec - initialize mem.current_tab when punching editor
|
ready to merge |
|
ok, @ChefZander you should merge it |
Problem
In the current implementation, the luacontroller memory and disk is read and write on every event. This is a problem because it's rather expensive and users cannot control how it's used. More often than not, nothing actually changed to these things during an event.
Proposed solution
(credit to frog for the idea) Instead of automagically having
memanddisksvariables be read-write in each event, instead that responsibility is passed to the user through these functions:read_mem()andwrite_mem()read_disk(),write_disk(),available_disks()andavailable_disk_names()For people that truly need speed, evenlinkswas reworked intoread_links().Because of the breaking change, the editor had to be adapted too. I've added some extra quality of life things and fixes. Most of the changes are in the
disktab.TODO
additionally. carefully enable JIT optimization (and disable time checking) in parts of the built-in functions.