Closed nikolailehbrink closed 3 weeks ago
Hello! I don't have a planned schedule right now, but I've been thinking about optimizing performance.
As you can see from the flowchart, the flow that performs the most transformations calls Prettier's format
function at least twice.
(And in reality, even during the line wrapping stage, it is called at least once per target class name.)
So, in my opinion, it would be good to reduce the number of calls to the format
function during the line wrapping stage, and ultimately it would be best if I could produce the expected result without double formatting.
In current plugins, setting the endingPosition
option to relative
or absolute
will be slightly faster than absolute-with-indent
.
Oh, there is an experimental speed improvement method I thought about a while ago, but currently this method can only be introduced in JavaScript or TypeScript.
What is the approximate proportion of each language that makes up your company's codebase?
Oh, there is an experimental speed improvement method I thought about a while ago, but currently this method can only be introduced in JavaScript or TypeScript.
What is the approximate proportion of each language that makes up your company's codebase?
Actually it is only TypeScript, would be pretty nice 👍
@nikolailehbrink v0.7.2
has been released, check it out!
After upgrading the version, try enabling the experimentalOptimization
option.
An experimental method I had previously considered was the introduction of a biome formatter. However, after investigating the execution time, I thought that it would be possible to optimize the internals of the core parts, so I did not introduce biome.
Hi @ony3000, thank you very much for the optimizations! Tried it out and it's a lot faster than before! Thank you! 👍
We would love to integrate this plugin into our company's codebase, which is quite large. I tested its speed along with
prettier-plugin-merge
andprettier-plugin-tailwindcss
to handle class wrapping.Here are the results:
prettier-plugin-tailwindcss
only: 23.181 secondsprettier-plugin-tailwindcss
,prettier-plugin-merge
, andprettier-plugin-classnames
: 71.284 secondsThe significant slowdown makes it difficult for us to justify using the plugin, despite the potential for a slightly improved developer experience. Are there any performance optimizations planned?
Thank you for the plugin and best regards.