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

perf: decrease parsing related garbage by using more transducers #146

Open
thenonameguy opened this issue Mar 9, 2020 · 3 comments
Open

Comments

@thenonameguy
Copy link

There are a few places internally that use unnecessary intermediate object allocation, especially operations over maps.
One project which has helped with this problem is https://github.com/cgrand/xforms
It has a syntactically easy abstraction of creating reduce-kv equivalent transducing contexts which avoid intermediate k/v vectors.

@wilkerlucio
Copy link
Owner

I already do use a lot of transducers in most of the code, did you know specific parts that are being problematic?

@thenonameguy
Copy link
Author

Mostly (into {} xform seq) can be optimizied, like:

(let [leave-items (into {} (comp (filter (comp #(= ::leave %) ::direction))

To not allocate intermediate vectors via juxt, by using (x/into {} (x/for ...) seq), like detailed here:
https://github.com/cgrand/xforms#on-key-value-pairs

@wilkerlucio
Copy link
Owner

Not sure how much that would improve, and currently I have no time to prioritize this. If you really feel this is a good approach, I could look into a PR with the changes, just can't do it myself.

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