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

Faster and more correct eagerization. #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

didibus
Copy link

@didibus didibus commented Jul 31, 2017

I improved eagerization by directly handling all Clojure and Java container types. The eagerization is now around 20 times faster, and can handle
eagerizing Clojure deftype, delays and Java Arrays. It can also properly
eagerize container's who's .toString or print-method have been modified
in a way which does not visit the elements.

After all the conversations, I thought I'd give it a go. I think with this, there's no need to offer pluggable eagerization, since I don't see any scenario where someone's eagerizing needs would not be covered by this.

This also sets things up to continually improve eagerization over time. In case a new edge case is found, or performance is still an issue.

EDIT: I've re-implemented it using protocols. So the way I did it, eagerization is extensible by users. So they don't even need to wait on the maintainers to add custom container types or override any of the logic used to eagerize. I still doubt there will be much need for this, but we get it for free because of protocols, as well as a massive performance boost, so its win/win.

container types. The eagerization is now 4 times faster, and can handle
eagerizing Clojure deftype and Java Arrays. It can also properly
eagerize container's who's .toString or print-method have been modified
in a way which does not visit the elements.
@didibus didibus mentioned this pull request Jul 31, 2017
This is 3x faster then
cond, and is now open for extenssion, so if users have custom container
types, they can simply extend them to support eagerize and it will work
fine with special.

For some reason, it doesn't work to extend object arrays for subtypes,
so I had to implement it as part of the java.lang.Object case.
@didibus
Copy link
Author

didibus commented Jan 27, 2019

Bump, have you ever looked into this? I had already forgot about it myself 😛 , but if you don't find anything wrong with it, I think it would be a good addition to Special.

damienstanton added a commit to damienstanton/special that referenced this pull request Jul 29, 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
1 participant