9 ms·
The JavaScript Oxidation Compiler
- zenon_paradox 8mo ago[flagged]
- root_axis 8mo agoI'm surprised to see it's that much faster than SWC. Does anyone have any general details on how that performance is achieved?
- ameliaquining 8mo agoThey wrote a post (https://oxc.rs/docs/learn/performance https://oxc.rs/docs/learn/performance) but it doesn't include direct comparisons to SWC.
- syspec 8mo agoTheir main page says 3x fast than SWC
- ameliaquining 8mo agoYeah, but not how their implementation techniques differ from SWC's to produce those results.
- grabshot_dev 8mo agoOne thing worth noting: beyond raw parse speed, oxc's AST is designed to be allocation-friendly with arena allocation. SWC uses a more traditional approach. In practice this means oxc scales better when you're doing multiple passes (lint + transform + codegen) on the same file because you avoid a ton of intermediate allocations. We switched a CI pipeline from babel to SWC last year and got roughly 8x improvement. Tried oxc's transformer more recently on the same codebase and it shaved off another 30-40% on top of SWC. The wins compound when you have thousands of files and the GC pressure from all those AST nodes starts to matter.
- snowhale 8mo ago[dead]
- pier25 8mo agoAll the Void Zero projects are super cool although I still wonder how they’re going to monetize all this.
- rk06 8mo agothey are going to use vite plus for monetization
- conartist6 8mo agoThe vite plus idea is that you'll pay for visual tools. What's odd to me is it makes their paid product kind of a bet against their open product. If their open platform were as powerful as it should be, it would be easy to use it to recreate the kinds of experiences they propose to sell. The paradox gains another layer when you consider that their whole mission is to build tools for the JavaScript ecosystem, yet by moving to Rust they are betting that JS-the-language is so broken that it cannot even host its own tools. And because JS is still a stronger language for building UIs in than Rust, their business strategy now makes them hard-committed to their bet that JS tools in JS are a dead end.
- rk06 8mo ago> they are betting that JS-the-language is so broken that it cannot even host its own tools. Evan wallace proved it by building esbuild. this is no longer bet. > If their open platform were as powerful as it should be, it would be easy to use it to recreate the kinds of experiences they propose to sell. you would be surprised to know that tech companies may find it cheaper to pay money than developer bandwidth for stuff beyong their core compentency. dropbox was also considered to be trivially implementable, but end users rarely try to re-invent it.
- lioeters 8mo ago> esbuild Another example is the TypeScript compiler being rewritten in Go instead of self-hosting. It's an admission that the language is not performant enough, and more, it can never be enough for building its own tooling. It might be that the tooling situation is the problem, not the language itself, though. I do see hopeful signs that JavaScript ecosystem is continuing to evolve, like the recent release of MicroQuickJS by Bellard, or Bun which is fast(er) and really fun to use.
- Ecko123 8mo ago[dead]
- sankalpmukim 8mo agoI wonder why did it take so long for someone to make something(s) this fast when this much performance was always available on the table. Crazy accomplishment!
- WD-42 8mo agoBecause Rust makes developers excited in a way that C/C++ just doesn't.
- grougnax 8mo agoC++ is pure trash C is fine but old
- phplovesong 8mo agoYou dont need C(++) for building performant software.
- pjmlp 8mo agoYeah, it is as if there were never other compiled languages before to rewrite JavaScripting tooling.
- dwattttt 8mo agoThe word 'excited' in GP's post isn't decorative.
- pjmlp 8mo agoI am fully aware of it, there have been many 'excited' posts in HN history about various programming languages, with related rewrite X in Y, the remark still stands.
- WD-42 8mo agoWhy do people get so mad that other people enjoy a language? If I’m more likely to rewrite some tooling because of the existence of a programming language and it’s more performant, isn’t that good for everyone? We are programmers we are supposed to like programming. These rust haters are intolerable.
- zdw 8mo agoThis compiles to native binaries, as opposed to deno which is also in rust but is more an interpreter for sandboxed environments?
- 3836293648 8mo agoDeno is a native implementation of a standard library, it doesn't have language implementation of its own, it just bundles the one from Safari (javascriptcore). This is a set of linting tools and a typestripper, a program that removes the type annotations from typescript to make turn it into pure javascript (and turn JSX into document.whateverMakeElement calls). It still doesn't have anything to actually run the program.
- ameliaquining 8mo agoDeno uses V8, which is from Chrome. Bun uses JavaScriptCore.
- 3836293648 8mo agoAh, yeah. Easy mistake
- lioeters 8mo agoI'm going to call it: a Rust implementation of JavaScript runtime (and TypeScript compiler) will eventually overtake the official TypeScript compiler now being rewritten in Go.
- madeofpalk 8mo ago? Most JavaScript runtimes are already C++ and are already very fast. What would rewriting in Rust get us?
- lioeters 8mo agoNothing, but it will happen anyway. Maybe improved memory safety and security, at least as a plausible excuse to get funding for it. Perhaps also improved enthusiasm of developers, since they seem to enjoy the newness of Rust over working with an existing C++ codebase. Well there are probably many actual advantages to "rewrite it in Rust". I'm not in support or against it, just making an observation that the cultural trend seems to be moving that way.
- robofanatic 8mo agooxidation is a chemical process where a substance loses electrons, often by reacting with oxygen, causing it to change. What does it have to do with JavaScript?
- ayhanfuat 8mo agoIt is written in Rust…
- nine_k 8mo agoOxidation of iron produces rust. Rust is the language of implementation of that compiler, and of the entire Oxc suite.
- phplovesong 8mo agoBut rust is named after a mushroom?
- apatheticonion 8mo agoI wrote a simple multi threaded transpiler to transpile TypeScript to JavaScript using oxc in Rust. It could transpile 100k files in 3 seconds. It's blisteringly fast
- iberator 8mo agosounds impossible to even index and classify files so fast. What hardware?
- ido 8mo agoI’m assuming they meant 100kloc rather than 100,000 files of arbitrary size (how could we even tell how impressive that is without knowing how big the files are?)
- deleted 8mo ago[deleted]
- AYBABTME 8mo agoLet's say 100k files is 300k syscalls, at ~1-2us per syscall. That's 300ms of syscalls. Then assume 10kb per file, that's 1GB of file, easily done in a fraction of a second when the cache is warm (it'll be from scanning the dir). That's like 600ms used up and plenty left to just parse and analyze 100k things in 2s.
- wangzhongwang 8mo ago[dead]
- chronicom 8mo agoThe goal is for Vite to transition to tooling built on Oxc. They’ve been experimenting with Rolldown for a while now (also by voidzero and uses oxc) - https://vite.dev/guide/rolldown https://vite.dev/guide/rolldown
- VPenkov 8mo agoOxc is not the first Rust-based product on the market that handles JS, there is also SWC which is now reasonably mature. I maintain a reasonably large frontend project (in the 10s of thousands of components) and SWC has been our default for years. SWC has made sure that there is actually a very decent support for JS in the Rust ecosystem. I'd say my biggest concern is that the same engineers who use JS as their main language are usually not as adept with Rust and may experience difficulties maintaining and extending their toolchain, e.g. writing custom linting rules. But most engineers seem to be interested in learning so I haven't seen my concern materialize.
- saghm 8mo agoIt's not like JS isn't already implemented in a language that's a lot more similar to Rust anyhow though. When the browser or Node or whatever other runtime you're using is already in a different language out of necessity, is it really that weird for the tooling to also optimize for the out-of-the-box experience rather than people hacking on them? Even as someone who writes Rust professionally, I also wouldn't necessarily expect every Rust engineer to be super comfortable jumping into the codebase of the compiler or linter or whatever to be able to hack on it easily because there's a lot of domain knowledge in compilers and interpreters and language tooling, and most people won't end up needing experience with implementing them. Honestly, I'd be pretty strongly against a project I work on switching to a custom fork of a linting tool because a teammate decided they wanted to add extra rules for it or something, so I don't see it as a huge loss that it might end up being something people will need to spend personal time on if they want to explore.
- latchkey 8mo agoI've played with all of these various formatters/linters in my workflow. I tend to save often and then have them format my code as I type. I hate to say it, but biome just works better for me. I found the ox stuff to do weird things to my code when it was in weird edge case states as I was writing it. I'd move something around partially correct, hit save to format it and then it would make everything weird. biome isn't perfect, but has fewer of those issues. I suspect that it is hard to even test for this because it is mostly unintended side effects. ultracite makes it easy to try these projects out and switch between them.
- sneak 8mo agoThought this was something related to Oxide Computer - they might want to be careful with that branding.
- swiftcoder 8mo agoThere are like 50 rust projects named by oxidation puns. This is hardly the first
- hu3 8mo agoI expected a coparison to `bun build` in the transformer TS -> JS part. But I guess it wouldn't be an apples to apples com parison because Bun can also run typescript directly.
- Jarred 8mo agoYou can find a comparison with `bun build` on Bun's homepage. It hasn't been updated in a little while, but I haven't heard that the relative difference between Bun and Rolldown has changed much in the time since (both have gotten faster). In text form: Bundling 10,000 React components (Linux x64, Hetzner) Bundler Version Time ───────────────────────────────────────────────────────── Bun v1.3.0 269.1 ms Rolldown v1.0.0-beta.42 494.9 ms esbuild v0.25.10 571.9 ms Farm v1.0.5 1,608.0 ms Rspack v1.5.8 2,137.0 ms
- galaxyLogic 8mo agoDoes oxc-parser make it easy to remove comments from JavaScript? In other words does it treat comments as syntactic units, or as something that can be ignored wince they are not needed by the "next stage"? The reason to find out what the comments are is of course to make it easy to remove them.
- xixixao 8mo agoShould be easy with any standard parser. See astexplorer.net
- galaxyLogic 8mo agoI've been using Esprima and it's not trivial to get rid of, or collect all comments with it. The reason is that while it finds the ranges of all syntactic JavaScript elements, it does not consider comment to be a syntactic element, but just something between them.
- RealityVoid 8mo agoFor the love of god, please stop naming Rust projects with "corrosion" and "oxidation" and the cute word pwns related to Rust because they are currently overplayed.
- hiuioejfjkf 8mo ago[dead]
- RealityVoid 8mo agoI said nothing about the rs prefix. But making oxide ferrous, Fe203 or whatever your whole shtick tells me nothing about your package and the pwn space is so so so very crowded at this point it just makes for a bad naming scheme.
- monster_truck 8mo agoAnd what do you name your packages
- owickstrom 8mo agoI'm using oxc_traverse and friends to implement on-the-fly JS instrumentation for https://github.com/antithesishq/bombadil https://github.com/antithesishq/bombadil and it has been awesome. That in combination with boa_engine lets me build a statically linked executable rather than a hodgepodge of Node tools to shell out to. Respect to the tools that came before but this is way nicer for distribution. Good times for web tech IMO.
- lerp-io 8mo agowhats the point of writing rust memory safe for js if js is already memory safe, ant u just write it in js???
- throw567643u8 8mo agoToo slow. Different people implemented linter, bundler, ts compiler in JS. That means three different parsers and ASTs, which is inefficient. These guys want a grand unified compiler to rule them all.
- philippta 8mo agoIt always comes as a surprise to me how the same group of people who go out of their way to shave off the last milliseconds or microseconds in their tooling care so little about the performance of the code they ship to browsers. Not to discredit OP's work of course.
- wiseowise 8mo agoPeople shaving off the last milliseconds or microseconds in their tooling aren't the same people shipping slow code to browsers. Say thanks to POs, PMs, stakeholders, etc.
- littlestymaar 8mo agoSometimes they are the same person. It just take someone to have poor empathy towards your users to ship slow software that you don't use.
- wiseowise 8mo agoI've never met a single person obsessed with performance who goes half the way. You either have a performance junkie or a slob who will be fine with 20 minutes compile times.
- littlestymaar 8mo agoI have. They cared a lot about performance for them because they hated waiting, but gave literally no shit about anyone else.
- staticassertion 8mo agoTBH I don't know how to do that work. If I'm in the backend it's very easy for me. I can think about allocations, I can think about threading, concurrency, etc, so easily. In browser land I'm probably picking up some confusing framework, I don't have any of the straightforward ways to reason about performance at the language level, etc. Maybe once day we can use wasm or whatever and I can write fast code for the frontend but not today, and it's a bit unsurprising that others face similar issues. Also, if I'm building a CLI, maybe I think that 1ms matters. But someone browsing my webpage one time ever? That might matter a lot less to me, you're not "browsing in a hot loop".
- Grom_PE 8mo agoI thought oxfmt would just be a faster drop-in replacement for "biome format"... It wasn't. Let this be a warning: running oxfmt without any arguments recursively scans directory tree from the current directory for all *.js and *.ts files and silently reformats them. Thanks to that, I got a few of my Allman-formatted JavaScript files I care about messed up with no option to format them back from K&R style.
- phplovesong 8mo agoGit undo?
- ctmnt 8mo agoIf only. But `jj undo`?
- jagged-chisel 8mo agoThese files are under version control, right? Or backed up. Right?
- watt 8mo agountil the day you accidentally run it in your home directory without any arguments.
- ramon156 8mo agoDo you not use a VCS?
- tomashubelbauer 8mo ago> running oxfmt without any arguments recursively scans directory tree from the current directory for all .js and .ts files and silently reformats them I've got to say this is what I would have expected and wanted to happen. I'd say it is wise to not run tools designed to edit files on files you don't have a backup for (like Git) without doing a dry-run or a small scope experiment first.
- wiseowise 8mo agoSo uv for JavaScript? Nice.
- silverwind 8mo agoNo, that would probably be pnpm, even thought it's not nearly as fast because it's written in JS.
- yla92 8mo agoI thought it's mainly written in Rust https://github.com/oxc-project/oxc https://github.com/oxc-project/oxc . Which oxc project is written in JS ?
- littlestymaar 8mo agoThey are talking about pnpm (which they said would be the uv equivalent for node, though I disagree given that what pnpm brings on top of npm is way less than the difference between uv and the status quo in Python).
- vivzkestrel 8mo ago- seeing this oxlint and oxfmt a lot lately - how does it compare to biome? - also biome does all 3 , linting, formatting and sorting, why do you want 3 libraries to do the job biome does alone?