-
Notifications
You must be signed in to change notification settings - Fork 8
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
Immutable state #81
base: master
Are you sure you want to change the base?
Immutable state #81
Commits on Nov 4, 2022
-
move mutable properties out of the state table
these are properties that we don't really want to be immutable
Configuration menu - View commit details
-
Copy full SHA for ba35d81 - Browse repository at this point
Copy the full SHA ba35d81View commit details -
implement API.read_only function
this will be what enforces immutability at runtime
Configuration menu - View commit details
-
Copy full SHA for 2ddce62 - Browse repository at this point
Copy the full SHA 2ddce62View commit details -
implement function to handle state changes
This is where the magic happens. Allowing for different levels of state changes while ensuring any specific state reference is immutable. Not yet tested for bugs.
Configuration menu - View commit details
-
Copy full SHA for 5991c4b - Browse repository at this point
Copy the full SHA 5991c4bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 37a7d76 - Browse repository at this point
Copy the full SHA 37a7d76View commit details -
add separate update and set state functions
This makes it much easier to make incremental changes to the current state. Also added a print function to maker debugging state values easier.
Configuration menu - View commit details
-
Copy full SHA for 78264e6 - Browse repository at this point
Copy the full SHA 78264e6View commit details -
API.copy_table: now dereferences readonly table references
The copies are not readonly.
Configuration menu - View commit details
-
Copy full SHA for 3a2d67d - Browse repository at this point
Copy the full SHA 3a2d67dView commit details -
Configuration menu - View commit details
-
Copy full SHA for a7d8a17 - Browse repository at this point
Copy the full SHA a7d8a17View commit details -
switch basic file browsing to use immutable states
Only the most basic operations have been ported, there is still a LOT of broken functionality.
Configuration menu - View commit details
-
Copy full SHA for 5b25e8d - Browse repository at this point
Copy the full SHA 5b25e8dView commit details
Commits on Nov 5, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 5505d42 - Browse repository at this point
Copy the full SHA 5505d42View commit details -
Configuration menu - View commit details
-
Copy full SHA for a051677 - Browse repository at this point
Copy the full SHA a051677View commit details -
fix memory leak from readonly cache
Since the readonly tables contain a reference to the original table we can't make the keys weak, at least not in Lua5.1. In Lua 5.2 weakly keyed tables act as ephemeron tables, so they would probably work there. I don't have a Lua5.2 build of mpv, so I can't test, but it might be worth using ephemeral tables when Lua5.2 is detected.
Configuration menu - View commit details
-
Copy full SHA for 2d75f91 - Browse repository at this point
Copy the full SHA 2d75f91View commit details -
ass: use a string buffer when drawing the browser
String manipulation is quite costly in Lua, this significantly reduces the number of garbage string produced and should help to speed up scrolling and reduce garbage collection. Reducing garbage collection is quite important since it directly impacts the performance of read-only tables lookups by clearing the cache.
Configuration menu - View commit details
-
Copy full SHA for d0eb295 - Browse repository at this point
Copy the full SHA d0eb295View commit details -
Configuration menu - View commit details
-
Copy full SHA for c92b3c1 - Browse repository at this point
Copy the full SHA c92b3c1View commit details -
read-only tables: store all indexed sub-tables in upvalue
This prevents the sub-tables from being garbage collected from the cache until the base read-only table has been garbage collected. This should significantly reduce the number of new read-only tables that are created while scrolling.
Configuration menu - View commit details
-
Copy full SHA for 781ce3f - Browse repository at this point
Copy the full SHA 781ce3fView commit details