Coder Social home page Coder Social logo

Comments (5)

pionxzh avatar pionxzh commented on July 23, 2024 1

Thanks. I'm benchmarking and improving the performance recently. This can be a good replacement for prettier. I will test it soon.

Before switching to biome, I will have to refactor the transformation to allow async function.

Update: biome's format function is not async. There is no dependency.👍

from wakaru.

pionxzh avatar pionxzh commented on July 23, 2024 1

I just tested oxc, but it's obviously not production ready yet. Will test biome later.

from wakaru.

pionxzh avatar pionxzh commented on July 23, 2024 1

I'm also considering using dprint. Highly configurable. It also support adding braces, so that we can retire un-curly-braces.

from wakaru.

0xdevalias avatar 0xdevalias commented on July 23, 2024

Benchmarking with hyperfine:

Running in the checked out directory of this repo (Ref):

⇒ npx prettier --version
3.1.1

⇒ npx biome --version
Version: 1.4.1

⇒ hyperfine --prepare 'git checkout -- unpacked/' 'npx prettier --write unpacked/' 'npx biome format --write unpacked/'
Benchmark 1: npx prettier --write unpacked/
  Time (mean ± σ):     13.243 s ±  0.675 s    [User: 21.156 s, System: 1.210 s]
  Range (min … max):   12.380 s … 14.071 s    10 runs

Benchmark 2: npx biome format --write unpacked/
  Time (mean ± σ):      1.514 s ±  0.135 s    [User: 3.343 s, System: 0.364 s]
  Range (min … max):    1.384 s …  1.775 s    10 runs

Summary
  npx biome format --write unpacked/ ran
    8.75 ± 0.90 times faster than npx prettier --write unpacked/

Config I used:

How that changed the formatted output:

  • 0xdevalias/chatgpt-source-watch@2505ac0
    • main improvements seemed to be to the indentation of nested ternaries, and some JSX blocks that previously weren't formatted
    • (note that apparently I was previously using an old 2.x version of prettier, so some of the changes shown here may have been improved/lessened if I formatted with a newer version of prettier first)

Based on the speed+formatting improvements, I ended up switching my repo over to using it:

from wakaru.

0xdevalias avatar 0xdevalias commented on July 23, 2024

Hadn't come across that one before; sounds interesting:

Would be interested to see how it performs speed-wise for comparable formatting.

from wakaru.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.