Skip to content

Consider rewriting the parser to make it copy-free #16

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
zbraniecki opened this issue Aug 17, 2017 · 2 comments
Closed

Consider rewriting the parser to make it copy-free #16

zbraniecki opened this issue Aug 17, 2017 · 2 comments
Assignees
Milestone

Comments

@zbraniecki
Copy link
Collaborator

At the moment the parser is copying some parts of the slice while creating the AST.

Most Rust parsers I can find in the wild rather rely on building AST that stores slices and aim for zero-copy mode.
Last example: https://github.com/viperscape/lichen/blob/master/src/parse.rs

I think we could do this here and it would probably benefit performance and memory. The cost is that if you want to modify the AST you'll have to copy it, but that seems to be a reasonable cost.
Most use cases only need to read the AST from what I know.

@TimDiekmann
Copy link

TimDiekmann commented Dec 4, 2017

Basically every String could be replaced with &'ctx str or at least with &'ctx [u8] as far as i inspected the source code.

@zbraniecki
Copy link
Collaborator Author

Fixed by #76

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

2 participants