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

Performance improvements #21

Open
jaronheard opened this issue Jan 25, 2021 · 5 comments
Open

Performance improvements #21

jaronheard opened this issue Jan 25, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@jaronheard
Copy link

jaronheard commented Jan 25, 2021

I'm wondering if there's some low-hanging fruit for performance improvements. I'm seeing a big performance slowdown after adding this extension on a real world project. Running prettier check takes 6.5x as long with this extension added on my Intel Macbook Pro. I tested using Node 12.16.1 and Node 14.6.0 with similar results.

I could dig around, but curious if others are seeing similar slowdowns. It seems like this plugin shouldn't be quite that computationally expensive.

Without extension

image

With extension

image

@jaronheard jaronheard added the enhancement New feature or request label Jan 25, 2021
@tqwewe
Copy link
Owner

tqwewe commented Feb 24, 2021

That is very slow I agree. I don't know of a good way to solve this.

For now I'm kind of waiting for prettier/prettier#4424 to be solved - when this happens I'll probably rewrite this plugin (might be silly, but would be fun to tackle the rewrite in Rust if possible).

@Airkro
Copy link

Airkro commented Feb 25, 2021

There is a sorter write by rust: https://github.com/avencera/rustywind, but it can't read the configuration file.

https://github.com/PutziSan/prettier-plugin-sort-class-names is faster but can't format vue files

@kainosnoema
Copy link

@acidic9 I would start by looking here. The algorithmic complexity of that underlying class name sort function is off the charts—so many trivial optimizations possible that would dramatically improve performance.

@Spice-King
Copy link

I've got a 8.84s check time without this plugin, which inflated to 168.10s once I installed it, little bit more than 19x slower. It's not like my machine is slow, Ryzen 5600x, 64GB of RAM @ 3200 MT/s, 512 GB Gen 3 NVMe SSD, and it's not like it's under a high load at the moment. At close to 3 minutes, this is kinda unusable, as it would make my git hooks and CI runs that much slower.

That said, give me a poke if you have a test version and want to see how much that puts a dent in it. Can't share the project as it's my work stuff, but I can give you the metrics for improving the speed of it. I'd like to see it be much faster so I could actually include it in our config.

@tqwewe
Copy link
Owner

tqwewe commented Nov 28, 2021

@Spice-King I did some messing around a couple of days ago and tried using WASM to make it faster.. but after some tests it turned out that JavaScript was way faster. But the code I was testing was completely rewritten and different to this projects code. I'll make a Github repo with some instructions for testing.. it might be quite useful getting some statistics from you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants