-
Notifications
You must be signed in to change notification settings - Fork 141
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
VScript serialisation rewrite #221
base: develop
Are you sure you want to change the base?
VScript serialisation rewrite #221
Conversation
On every save on a load, these functions would keep reference to their old versions from the previous save which kept stacking up on each load-save
@@ -22,13 +22,15 @@ | |||
#include "sqstdmath.h" | |||
#include "sqstdstring.h" | |||
|
|||
// HACK: Include internal parts of squirrel for serialization |
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.
This is still a HACK, in fact it's even a bigger reach into the internals now.
It would be good to look at what can be done to avoid over reaching too far into internals and abstract away what's needed, even if the parts that depend on internals are in their own cpp file.
It's worth also looking to push it up stream to the squirrel lang repo what ever is needed to have proper serialization, this initial version was very hacky and needed to reach into the internals, I did have plans to push more upstream.
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.
Implementing complete serialisation natively in Squirrel would be very a large change (and an undertaking), I don't see such feature being accepted any time soon if at all.
Having a substantial serialisation does require accessing the internals anyway. Adding interface to access what is required is also unrealistic since what is required is everything.
cdc8741
to
5eccbe3
Compare
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.
I've noticed this PR is no longer in a draft state, so I'm assuming you're done with these changes and you believe this is safe to be merged. I'm not familiar enough with most of the code involved to give a fair assessment on it, but I conducted a light review and I didn't see anything that stood out to me.
Due to the sensitivity of these changes, I'm going to wait before merging this to ensure there's no remaining objections or comments surrounding it.
I think it's ready. I don't remember having any ref discrepancies left on save/restore. Previous save-breaking changes doesn't seem to have increased saverestore version numbers, perhaps version increment is not really needed. |
5fba33e
to
1abf0ce
Compare
d1f80ea
to
8c0b3f2
Compare
093b4b9
to
3aad0f5
Compare
Current implementation had too many problems and unfixable issues with the approach it took. I rewrote
SquirrelVM::WriteState()
andSquirrelVM::ReadState()
from scratch, fixing not only the linked issues but also various other undocumented issues.This PR fixes serialisation of attributes, threads and generators, improves performance by skipping the VM stack alltogether in serialisation - previously it would push and pop every object to the VM stack, unnecesarily adding a lot of overhead. A very rudimentary test showed this code is approximately 12% faster in
WriteState
, 30% faster inReadState
.This obviously is not backwards compatible. The only way to keep it compatible would be keeping a copy of the old read code for matching version numbers.
Does this PR close any issues?
fixes #99 (although this was already marked fixed, I believe this is the same issue as #219)
PR Checklist
develop
branch OR targets another branch with a specific goal in mind