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

Better performance #7

Closed
davesnx opened this issue Sep 10, 2020 · 1 comment
Closed

Better performance #7

davesnx opened this issue Sep 10, 2020 · 1 comment

Comments

@davesnx
Copy link
Owner

davesnx commented Sep 10, 2020

First I would love to profile q and try to understand where are the pain points, and I have no clue how to do that yet.

Assumption

The biggest operation is reading the file and parsing the JSON if the JSON is huge, this becomes more of a problem.

Exploration

I would expect OCaml multicore to help on the parallelization of parse/compile the user input while parse the JSON, that would speed up things, but I would love to parse the parts of the JSON that q needs, instead of parsing the entire file.

The other idea was improving the parsing of the JSON perse, there an exploration to that, which tries to make the JSON parsing a parallelizable operation, it's called "Stack Monoid" https://raphlinus.github.io/gpu/2020/09/05/stack-monoid.html.

Assumption

query-json's AST is recursive which makes the compilation to be recursive as well and it's tail-recursive, I heard that OCaml compiler optimizes the TL.

while jq, is a stack based described here and they are doing a lot of more work than query-json.

Exploration

See how the OCaml compiler optimizes our TL, and check that the recursion is TL.
Explain better how the jq Stack works.

Assumption

menhir it's a parser generator, which you write your rules in .mly files and OCaml creates the parser for you. It's obvious that having a parser written natively sounds that could be more optional in terms of performance.

Exploration

How much effort would be to turn the Parser.mly into a regular Reason file and how much it will improve performance.

@davesnx
Copy link
Owner Author

davesnx commented Oct 8, 2020

@davesnx davesnx closed this as completed Jan 30, 2023
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

1 participant