Skip to content
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

Performance improvements #1

Open
Specy opened this issue Dec 4, 2023 · 2 comments
Open

Performance improvements #1

Specy opened this issue Dec 4, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Specy
Copy link
Owner

Specy commented Dec 4, 2023

Currently, during the transformation, function calls and reading a parameter return an owned value of the primitive. This isn't the best as it means that every time a function is called or a parameter is read, there will be a clone. I'm not sure what a good way to solve this would be, but I'm pretty much thinking a sort of heap type could be added to the transformer context, and variables will then have a reference to an Rc or something similar, then adding another primitive (Primitive::Ref) that will be a reference to an owned primitive, or something to derive the reference (like an id) (the owned value will be in this heap type)

@Specy Specy added enhancement New feature or request help wanted Extra attention is needed labels Dec 4, 2023
@Specy
Copy link
Owner Author

Specy commented Dec 5, 2023

this would also introduce issues like "when to delete that reference", at that point we could introduce a lifetime model like a RAII, so when the current context frame is popped, the constants that were declared in it will be dropped, and the references to previous owned primitives will still be available as they are in other frames. In general, as the language was designed, it wouldn't be possible for a parent frame to hold references created in child frames, so this approach should work

@Specy
Copy link
Owner Author

Specy commented Feb 19, 2024

Instead I could just use Rc + RefCell or use the Gc crate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant