Skip to content

Improve parser performance 100x #23

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

Merged
merged 1 commit into from
May 2, 2025
Merged

Conversation

neoxelox
Copy link
Contributor

@neoxelox neoxelox commented May 1, 2025

Improve parser performance 100x by not using regexes and doing the matching manually. It does pass all tests but a deep review is needed.

Also, this is at best a patch... we should review all the parser code (and order parts of PromptL) to avoid using regexes as much as possible (specially if they are inside a loop).

Maybe regex were working somewhat well in native PromptL in javascript, but in the WASM (python SDK) version they were an absolute bomb and prompts of just 200 lines took minutes to parse and compile.

@neoxelox neoxelox requested a review from csansoon May 1, 2025 19:34
Copy link
Contributor

@csansoon csansoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Contributor

@geclos geclos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@neoxelox neoxelox merged commit 4202992 into main May 2, 2025
2 checks passed
@neoxelox neoxelox deleted the improve-parser-performance branch May 2, 2025 10:14
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

Successfully merging this pull request may close these issues.

4 participants