xixiaofinland / afmt

Salesforce Apex code formatter written in Rust
20 stars 3 forks source link

Release should include Apple Silicon (arm64) binary #4

Closed aheber closed 6 days ago

aheber commented 1 week ago

The existing release process includes MacOS x86_64 binary. It would be great if it could also include a binary optimized for amd64/Apple Silicon. This would allow it to be more performant on that platform as it has to go through a translation layer right now.

It is possible to compile one binary that includes code optimized for both platforms. This is known as "fat binaries" or "universal binaries" it would bloat the download size but I personally wouldn't be very worried about that as an occasional download that I'm keeping on my personal machine.

xixiaofinland commented 6 days ago

amd64/Apple Silicon binary was added since release v0.0.12 though I'm not sure if this is more performant.

Not sure if the fat binary is the way to go, I had no experience on it. If it's industry standard, why not :). There are also ways to reduce the binary size, but these optional improvements will be handled at a much later phase.

aheber commented 6 days ago

Great!! I just tested it and it is working on my machine.

The Intel binary formatted my largest file in ~300ms and the Apple Silicon in ~220ms (as low as ~200)

My smaller file test was ~17ms on Intel and ~3ms on Apple Silicon.

All of those are small numbers but that time would really add up across an entire project.

Thank you very much!

xixiaofinland commented 6 days ago

Cool! Once we need to handle multiple files or a entire project, multi-threading in this scenario is a perfect fit and Rust shines in handling it. We will see how it goes in the future :)

aheber commented 6 days ago

Yes! Very excited to see it.