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

css helper awful performance #1805

Closed
alextewpin opened this issue Jun 13, 2018 · 3 comments

Comments

@alextewpin
Copy link

commented Jun 13, 2018

I've already summarised my thoughts here.

css helper have awful performance. That's basically it. It see no reason why it should be recommended or enforced, but I see at least one why it should be considered harmful.

I've made a codesandbox demo to test css performance and as I can see it's ~50-100 times slower than good old functions that returns plain strings.

It that really it? Why it's recommended? Am I missing something?

@probablyup

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

Interesting. @mxstbr do you have any commentary on this?

If at this point there's no particular usefulness to the css helper other than syntax highlighting, we could just convert it to be a simple passthrough.

@taneba

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2018

This issue seems to be better in v4.

Here is a forked one which uses 4.0.0-beta.5. Still slower but css is slower about ~10-20 times than plain strings.

@probablyup

This comment has been minimized.

Copy link
Contributor

commented Sep 17, 2018

Yes, it's unavoidable @taneba

Simple template literals can't handle interpolated functions, etc in the special way we need for everything to work properly. I've made some refactorings to the helper in v4 as you've noticed, but there is an upper limit to how much we can optimize it.

That being said, you only need to use the css helper when you're doing a function, component, or object interpolation. If you're putting in a simple string value, you can use a regular template literal.

@probablyup probablyup closed this Sep 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.