-
Notifications
You must be signed in to change notification settings - Fork 5
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
Lint performance slower than biome
and even slower than Prettier
#35
Comments
That's not an accurate measurement of the performance of this crate because that's being run through dprint's CLI. What you're actually mostly measuring is the dprint CLI's baseline startup and exit time. For example, if you use If you want to measure performance of this crate then you need to run it directly (on my machine it formats those files in ~0-2ms). |
@dsherret Thank you for feedback. Actually, the project reason is just Can you please fix benchmarking then or how i can improve |
What that benchmark has shown is that all of them are sub 400ms which is practically very good when executing from the command line like that or running in a CI. What should matter is very large file formatting times (which this crate is not especially good at) and performance of formatting many files (which the dprint CLI is very good at, especially once the incremental cache is in place--this can be cached on a CI dprint/dprint#740).
I don't have time to fix the benchmark and I'd recommend removing dprint-plugin-json from the benchmark since it's not even executed in it (since the warmup will cause the result to be cached). For example, if you add Going to close this one. |
Meant to say |
Sorry then for disturbing you @dsherret Unfortunately i didn't found any reference to The addition on documentations about these differences could help users choose proper way to use your Thanks |
I meant
Needed to set a
|
Yeah, seems i wrong read Anyway, thank you for reply and sorry for issue which i'm made wrong (maybe because of i didn't read docs good?) |
The |
Updated previous my comment. Is there any such flag for |
Sorry, I misunderstood. |
Thank you. So benchmark CLI command used for dprint in benchmark is not wrong then |
@dalisoft I improved the startup time of dprint's cli on mac and linux in 0.45.1 (just released). It was unconditionally reading certificates from the system on startup for https requests, which was fast on windows, but not on mac.
I noticed though that in the benchmark, dprint is installed via
|
Thank you for update @dsherret |
Benchmark 1: biome format data/package-template.json
Time (mean ± σ): 69.4 ms ± 48.3 ms [User: 34.6 ms, System: 13.8 ms]
Range (min … max): 41.4 ms … 125.2 ms 3 runs
Benchmark 2: prettier -c data/package-template.json
Time (mean ± σ): 126.4 ms ± 32.9 ms [User: 105.2 ms, System: 11.3 ms]
Range (min … max): 106.4 ms … 164.4 ms 3 runs
Benchmark 3: ./node_modules/dprint/bin.js check data/package-template.json
Time (mean ± σ): 52.8 ms ± 10.8 ms [User: 36.5 ms, System: 10.5 ms]
Range (min … max): 46.1 ms … 65.2 ms 3 runs
Benchmark 4: ./node_modules/dprint-rs-npm/dprint check data/package-template.json
Time (mean ± σ): 12.0 ms ± 8.2 ms [User: 3.3 ms, System: 4.9 ms]
Range (min … max): 7.2 ms … 21.5 ms 3 runs
Benchmark 5: deno fmt data/package-template.json
Time (mean ± σ): 19.8 ms ± 23.0 ms [User: 4.5 ms, System: 4.9 ms]
Range (min … max): 6.4 ms … 46.4 ms 3 runs
Benchmark 6: jsona fmt --option trailing_newline=true --check data/package-template.json
Time (mean ± σ): 5.5 ms ± 4.1 ms [User: 1.7 ms, System: 1.8 ms]
Range (min … max): 2.4 ms … 10.2 ms 3 runs
Benchmark 7: spectral lint --ignore-unknown-format data/package-template.json
Time (mean ± σ): 398.5 ms ± 62.7 ms [User: 414.2 ms, System: 49.1 ms]
Range (min … max): 360.2 ms … 470.8 ms 3 runs
Summary
jsona fmt --option trailing_newline=true --check data/package-template.json ran
2.18 ± 2.19 times faster than ./node_modules/dprint-rs-npm/dprint check data/package-template.json
3.58 ± 4.94 times faster than deno fmt data/package-template.json
9.54 ± 7.35 times faster than ./node_modules/dprint/bin.js check data/package-template.json
12.55 ± 12.78 times faster than biome format data/package-template.json
22.86 ± 17.99 times faster than prettier -c data/package-template.json
72.08 ± 54.71 times faster than spectral lint --ignore-unknown-format data/package-template.json
Benchmark 1: biome format data/package-lock-test.json
Time (mean ± σ): 54.4 ms ± 14.6 ms [User: 39.9 ms, System: 9.1 ms]
Range (min … max): 44.9 ms … 71.3 ms 3 runs
Benchmark 2: prettier -c data/package-lock-test.json
Time (mean ± σ): 154.9 ms ± 3.5 ms [User: 196.4 ms, System: 13.2 ms]
Range (min … max): 152.5 ms … 158.9 ms 3 runs
Benchmark 3: ./node_modules/dprint/bin.js check data/package-lock-test.json
Time (mean ± σ): 49.8 ms ± 1.3 ms [User: 39.4 ms, System: 8.7 ms]
Range (min … max): 48.9 ms … 51.3 ms 3 runs
Benchmark 4: ./node_modules/dprint-rs-npm/dprint check data/package-lock-test.json
Time (mean ± σ): 10.8 ms ± 0.2 ms [User: 6.8 ms, System: 3.3 ms]
Range (min … max): 10.7 ms … 11.0 ms 3 runs
Benchmark 5: deno fmt data/package-lock-test.json
Time (mean ± σ): 6.7 ms ± 0.4 ms [User: 4.1 ms, System: 1.9 ms]
Range (min … max): 6.4 ms … 7.1 ms 3 runs
Benchmark 6: jsona fmt --option trailing_newline=true --check data/package-lock-test.json
Time (mean ± σ): 5.4 ms ± 0.1 ms [User: 4.4 ms, System: 1.0 ms]
Range (min … max): 5.4 ms … 5.5 ms 3 runs
Benchmark 7: spectral lint --ignore-unknown-format data/package-lock-test.json
Time (mean ± σ): 372.5 ms ± 3.9 ms [User: 424.5 ms, System: 42.7 ms]
Range (min … max): 369.4 ms … 376.9 ms 3 runs
Summary
jsona fmt --option trailing_newline=true --check data/package-lock-test.json ran
1.24 ± 0.07 times faster than deno fmt data/package-lock-test.json
1.99 ± 0.04 times faster than ./node_modules/dprint-rs-npm/dprint check data/package-lock-test.json
9.17 ± 0.27 times faster than ./node_modules/dprint/bin.js check data/package-lock-test.json
10.03 ± 2.70 times faster than biome format data/package-lock-test.json
28.55 ± 0.72 times faster than prettier -c data/package-lock-test.json
68.64 ± 1.06 times faster than spectral lint --ignore-unknown-format data/package-lock-test.json
Benchmark 1: biome format data/twitter.json
Time (mean ± σ): 64.1 ms ± 4.5 ms [User: 53.2 ms, System: 8.4 ms]
Range (min … max): 60.2 ms … 69.0 ms 3 runs
Benchmark 2: prettier -c data/twitter.json
Time (mean ± σ): 331.7 ms ± 2.7 ms [User: 563.1 ms, System: 29.0 ms]
Range (min … max): 329.1 ms … 334.5 ms 3 runs
Benchmark 3: ./node_modules/dprint/bin.js check data/twitter.json
Time (mean ± σ): 88.1 ms ± 0.4 ms [User: 76.1 ms, System: 10.0 ms]
Range (min … max): 87.7 ms … 88.4 ms 3 runs
Benchmark 4: ./node_modules/dprint-rs-npm/dprint check data/twitter.json
Time (mean ± σ): 49.4 ms ± 0.7 ms [User: 43.9 ms, System: 5.0 ms]
Range (min … max): 48.7 ms … 50.2 ms 3 runs
Benchmark 5: deno fmt data/twitter.json
Time (mean ± σ): 42.5 ms ± 0.3 ms [User: 37.7 ms, System: 4.5 ms]
Range (min … max): 42.2 ms … 42.7 ms 3 runs
Benchmark 6: jsona fmt --option trailing_newline=true --check data/twitter.json |
I am creating all-in-one linter (yes, another one) and found
dprint-plugin-json
slower thanbiome
(even both written in Rust) and even slower than Prettier.Here benchmark repo: https://github.com/dalisoft/json-lint-benchmark
Here project which does
JSON
linting/formatting very fast: https://github.com/jsona/jsonaI am migrated project into JS ecosystem by using
download binary
method, see at here if you want checkpackage-lock.json
package.json
The text was updated successfully, but these errors were encountered: