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

Add info about performance considerations #103

Merged
merged 1 commit into from
Jun 29, 2020
Merged

Add info about performance considerations #103

merged 1 commit into from
Jun 29, 2020

Conversation

kennyjwilli
Copy link
Contributor

The performance differences between using forms handled by Sablono's compile-form and not are not documented. Because the difference is so significant, I think it is worth adding to the README.

The performance differences between using forms handled by Sablono's [`compile-form`](https://github.com/r0man/sablono/blob/master/src/sablono/compiler.clj#L93) and not are not documented. Because the difference is so significant, I think it is worth adding to the README.
@rauhs
Copy link
Contributor

rauhs commented Nov 8, 2016

I actually added some of these thoughts a while back to:

https://github.com/r0man/sablono/wiki/Optimization-Tips

Also talks about code size (hence avoiding for). A few weeks ago I also wanted to make sure to never call interpret in my app. Since I got tired of adding ^String typehints all over my code and double checking everything, I decided to just remove the intepret altogether. I.e. you'll get an error if you don't precompile your code. It's an ugly hack but it works:

https://gist.github.com/rauhs/38b8598c6549f2fe09ad4d257382ec32

I agree there should be some awareness of interpret vs compile during macro expansion since that gives rum a speedup of roughly 2x over reagent.

@kennyjwilli
Copy link
Contributor Author

kennyjwilli commented Nov 8, 2016

It almost seems like there should be a dynamic var, similar to *warn-on-reflection*, that allows you to get warning messages when the interpreter is called. Also, maybe another dynamic var that would allow you to turn off interpretation all together (probably worth creating an issue in Sablono for these features).

The problem with using mapv instead of for is you don't get the pre-compilation, making your render time basically the same as using map.

I have also submitted r0man/sablono#135 which lets you use a shorter metadata tag :inline to skip compilation (it also makes more sense in the general case -- it doesn't make sense to type hint a function that returns a React component as a String).

@roman01la
Copy link
Collaborator

Hello. New maintainer here 👋

It's good to be aware of these differences, but I'd also rephrase the text so it doesn't feel like it pushes you towards refactoring your project and keeping an eye on the code to be specifically written for Sablono.

Interpreter improvements are on my roadmap. Currently Sablono is much slower than Reagent in interpretation mode, unfortunately.

@roman01la
Copy link
Collaborator

Added rum.core/set-warn-on-interpretation! here 66d352a

@roman01la roman01la merged commit c893917 into tonsky:gh-pages Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants