25 ms·
Bun: Fast JavaScript runtime, transpiler, and NPM client written in Zig
- WaffleIronMaker 4y agoNote that the bun install [1] seems to be hosted as an HTML file, not as a text file. I'm not sure to what extent that causes issues, but it seems atypical. [1] https://bun.sh/install https://bun.sh/install
- formerly_proven 4y agoThere's just no Content-Type header so the browser guesses it's probably maybe HTML.
- gildas 4y ago$ curl --head -H "Accept: text/plain" https://bun.sh/install HTTP/2 200 date: Wed, 06 Jul 2022 10:21:57 GMT content-type: text/html; charset=utf-8 ...
- deleted 4y ago[deleted]
- formerly_proven 4y agoMy bad, I was looking at a 304 without noticing.
- ryloric 4y agoWhy choose Zig, is there something it provides that makes it particularly suitable for this type of project?
- gnuvince 4y agoFrom the webpage: > An enourmous amount of time spent profiling, benchmarking and optimizing things. The answer is different for every part of Bun, but one general theme: Zig's low-level control over memory and lack of hidden control flow makes it much simpler to write fast software. With modern hardware, accessing memory efficiently is key to writing fast software. Programs written in programming languages that don't let the developer control how data is laid out in memory usually face an uphill battle to be fast.
- m0meni 4y agoAs far as I know, one guy made this (https://twitter.com/jarredsumner https://twitter.com/jarredsumner) working 80h-90h on it a week. His twitter has some cool performance insights into JS and JS engines. It's the biggest Zig codebase too I think. Congrats on the release :)
- 8n4vidtmkvmk 4y agoover how many weeks?
- cercatrova 4y ago> a little over a year ago https://news.ycombinator.com/item?id=31993615 https://news.ycombinator.com/item?id=31993615
- 8n4vidtmkvmk 4y agoThat's pretty good! Big project to accomplish in a year
- Jarred 4y agoI started building Bun a little over a year ago, and as of about 20 minutes ago, its in public beta One of the things I'm excited about is bun install. On Linux, it installs dependencies for a simple Next.js app about 20x faster than any other npm client available today. hyperfine "bun install --backend=hardlink" "yarn install --no-scripts" "npm install --no-scripts --ignore-scripts" "pnpm install --ignore-scripts" --prepare="rm -rf node_modules" --cleanup="rm -rf node_modules" --warmup=8 Benchmark #1: bun install --backend=hardlink Time (mean ± σ): 25.8 ms ± 0.7 ms [User: 5.4 ms, System: 28.3 ms] Range (min … max): 24.4 ms … 27.6 ms 76 runs Benchmark #2: yarn install --no-scripts Time (mean ± σ): 568.4 ms ± 15.3 ms [User: 781.6 ms, System: 497.4 ms] Range (min … max): 550.8 ms … 604.5 ms 10 runs Benchmark #3: npm install --no-scripts --ignore-scripts Time (mean ± σ): 1.261 s ± 0.017 s [User: 1.719 s, System: 0.516 s] Range (min … max): 1.241 s … 1.286 s 10 runs Benchmark #4: pnpm install --ignore-scripts Time (mean ± σ): 1.343 s ± 0.003 s [User: 601.3 ms, System: 151.6 ms] Range (min … max): 1.339 s … 1.348 s 10 runs Summary 'bun install --backend=hardlink' ran 22.01 ± 0.85 times faster than 'yarn install --no-scripts' 48.85 ± 1.51 times faster than 'npm install --no-scripts --ignore-scripts' 51.99 ± 1.45 times faster than 'pnpm install --ignore-scripts'
- the_duke 4y agoThe benchmark source code links on the homepage are "Not found". Also a few questions: What do you attribute the performance advantage to? How much of it is JavascriptCore instead of v8 versus optimized glue binding implementations in the runtime? If the latter, what are you doing to improve performance? Similarly for the npm client: how much is just that bun is the only tool in a compiled /GC free language versus special optimization work? How does Zigs special support for custom allocators factor in?
- Jarred 4y agowill fix the broken links shortly edit: should be fixed
- 4y ago
- adamwathan 4y agoI've been following Jarred's progress on this on Twitter for the last several months and the various performance benchmarks he's shared are really impressive: https://twitter.com/jarredsumner/status/1542824445810642946 https://twitter.com/jarredsumner/status/1542824445810642946 Easy to dismiss this as "another JS build tool thing why do we need more of this eye roll" but I think this is worth a proper look — really interesting to follow how much effort has gone into the performance.
- slimsag 4y agoAgreed, I've also been following his work for a while now. Jarred is pulling off something very impressive here :) Congratulations on the public beta!
- clarkmoreno 4y agobig agree!
- bogwog 4y ago> curl https://bun.sh/install https://bun.sh/install | bash This type of thing needs to stop
- metadaemon 4y agoYeah, people should be using fish! /s
- 0des 4y agosomeone demonstrated a while back how based on user agent you could serve innocuous code for a browser checking the code first, and then a different malicious payload for curl. thanks to dementiapatien below for the link https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-bash-server-side/ https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-b...
- asadlionpk 4y agoI disagree. This reduces friction for users. Users should be aware of what/who they are trusting.
- capableweb 4y agoOk, let's say I have a experimental tool I want to distribute to people with a easy install. What way would you prefer to install it? Going through package registries/repositories is a slow process, so obviously want something faster. Just GitHub releases? Would you be fine if the URL instead pointed to GitHub in that case?
- forrestthewoods 4y agoAll I want is a download link to a single .exe. Or a zip if it has runtime content/dependencies. GitHub release is fine.
- capableweb 4y agoSo then Bun is doing fine here? They have GitHub Release activated and are using it for releases.
- alexarena 4y agoCongrats! Cool to see a new class of JS runtimes springing up. Lots to be excited about here, but cold start time seems like a game changer for building at the edge.
- jakearmitage 4y agoAny special magic going on with the interpreter code? Did zig allow you to write a more performant parser/AST walker?
- fuu_dev 4y agoZigs makes cross compiling easier and is on par with c/c++ in terms of performance. There is no magic trick else just personal preference i assume.
- williamstein 4y agoFrom the page: “Why is Bun fast? An enourmous amount of time spent profiling, benchmarking and optimizing things. The answer is different for every part of Bun, but one general theme: zig's low-level control over memory and lack of hidden control flow makes it much simpler to write fast software.”
- conaclos 4y agoBun parser is a translation in Zig of ESbuild's parser. ESbuild parser is already well tuned. Bun takes zig advantages to go further.
- abdellah123 4y agoI wonder how is the performance comparison between the two? And can I use bun parser as a drop in replacement for esbuild?
- conaclos 4y agoESbuild is much more mature than bun. The author of ESbuild cares a lot about compatibility with other bundlers and stability. Moreover it is already insanely fast. I am not sure there is any interest to switch from ESbuild to bun for bundling or transpiling code. By the way, I think that bun does not apply the patches of ESbuild since the translation date.
- ccheever 4y agoI've been following this project for a while now, and it's incredibly ambitious. It will take a while to reach its full potential but Jarred is doing an extraordinary amount of very good work on it, and I think there is a very good chance this will turn out to be a pretty big deal.
- kylemh 4y agoA special dev, releasing a special thing. Chuffed for Jarred. I'm hoping Bun hops to me even quicker than it can run.
- cyansmoker 4y agoCongrats! This is making me reconsider using the node ecosystem in some of my projects.
- switz 4y agoI'm really excited about bun – it represents an opportunity to deeply speed up the server side javascript runtime and squeeze major performance gains for common, real-world uses-cases such as React SSR. Also, Jarred's twitter is a rich follow full of benchmarks and research. If nothing else, this project will prove to be beneficial to the entire ecosystem. Give it some love.
- nine_k 4y agoWhy would V8 be less suitable for stuff like React SSR, compared to JSCore? I have no opinion, just interesting.
- oorza 4y agoFaster startup -> lower serverless bills for a lot of shops. Shaving 25ms off a request might not seem like it's important, but if that saves you a million serverless seconds in aggregate, you just earned a bonus.
- brunojppb 4y agoThis is an impressive achievement! Congrats Jarred for this initiative. This is going to help JS ecosystem to move further ahead.
- yes_but_no 4y agogratz, what was using Zig like? What kind of problems you had?
- tylerchurch 4y agoAny detailed comparison of this vs. Node.js vs. Deno?
- throwawaymaths 4y agoI did a quick comparison for my own reasons of using them as an "absolutely stupid runner" which boots a fresh VM, runs some JavaScript that converts a piece of JSON, and gets out (this is likely mostly measuring VM boot and cleanup only). Bun was crazy fast: a factor of 2 over libmozjs, and a factor of 3 over nodejs
- asciiresort 4y agoNot to be a cynic, but I wonder how much of the motivation to create a competing runtime in recent months is in response to the eye gauging ( I know, I know. It’s all relative ) tens of millions in funding Deno just raised. I don’t intend this as a knock on this project. Competition is good and, this space, unlike the rest of JavaScript, could do with more players. There are some promising numbers and claims here. I hope it works out. I’m genuinely posing this intellectual question of financial incentive as an theory for JavaScript fatigue as a whole. High profile threads on JavaScript fatigue trend on HackerNews multiple times a week. The wide range of theories about why web developers reinvent the wheel strangely leave out the financial incentives. Everyone claims their framework is the fast, powerful, light, batteries included, modern, retro futuristic, extensible, opinionated, configurable, zero config, minimal (3kb, gzipped minified, of course ). The list goes on. A few days ago, I was chatting with someone how all these JavaScript libraries make these words have no meaning. To demonstrate, I screenshared a bunch of landing pages. At this point, I haven’t exhaustively, in one sitting, cross referenced these landing pages. 90% of the libraries shared the same layout. 3 columns / cards with one of those hyperbolic words. Previously I thought it was pretentious and weird that Svelte marketed itself as “cybernetically enhanced web apps”. What does that even mean? Then again, none of the descriptor words like light, dynamic, and ergonomic mean much. At least Svelte was memorable. Occasionally, one of these libraries would describe their interface as being ergonomically designed. As if other developers designed their interfaces to not be ergonomic. It’s like how we’d all like to think we’re nice, good, decent people. The majority of people would not do bad stuff if they perceived it as such. I do think most JavaScript developers have good intentions. Then I’ve also seen DevRel / Evangelist types who shill their library, with disingenuous benchmarks, knowing full well there are better solutions, or that they can help make existing solutions better, to everyone’s benefit. The spoils include consulting, training, speaking fees, books, swag, collecting Patreon ( there are some controversial projects which come to mind ), resume building, GitHub activity social capital ( I’ve talked to some recruiters who were fixated on the idea that you publish code on GitHub, specifically Github, because to them, VCS=Git=GitHub, or it doesn’t exist )
- firloop 4y agoJarred's been working on bun for over a year. I don't get the sense that it's a reaction to anything recent at all, Jarred is just super passionate about building the best JavaScript runtime.
- julienb_sea 4y agoThis is super cool and if I was working on more personal projects I would be tempted. In an enterprise context, moving to a reimplementation of core Node APIs is a terrifying prospect. There are infinite possible subtle problems that can appear and debugging even within official Node has been a challenge in the past. I don't know how this concern can be alleviated without seeing proven usage and broader community acceptance.
- andyfleming 4y agoIt is scary, but it already seems more stable and backward-compatible than Deno. With some testing and further stabilization, I have a feeling bun might be a much more feasible and beneficial move.
- andrew_ 4y agoIt's not backwards compatible, it's just Node compatible. Demo is not, and it's stated as much clearly. Thus the suggestion that bun is more backward-compatible than Deno is incorrect and speaks to a fundamental misunderstanding of the two projects.
- andyfleming 4y agoSure, a poor choice of words. Node compatibility is what matters to me (and likely many others) practically as a node developer. Deno's benefits don't outweigh the costs of migrating to it and adopting it more broadly, in my opinion.
- 8n4vidtmkvmk 4y agotried deno briefly the other day, was a real pain. just wanted to hash some files. they had an std hash lib but dropped it in favor of web crypto which bazzarely doesn't have a hash.update method for streaming?? not very good. prefer node's impl
- ksm1717 4y agoI have a hunch that this concern can be alleviated with proven usage and broader community acceptance
- truth_seeker 4y agoRoadmap goals looks promising, especially under the Runtime section. https://github.com/Jarred-Sumner/bun/issues/159 https://github.com/Jarred-Sumner/bun/issues/159 Best of luck.
- immigrantheart 4y agoThe best part of being a JavaScript programmer is that you have the entire world working for you for free.
- choward 4y agoWhat makes this specific to JavaScript? It applies to all open source.
- skybrian 4y agoOften it's for smaller values of "the entire world" though.
- immigrantheart 4y agoAlmost everyone works in JavaScript.
- kwizzt 4y agoThere’s a large world outside of JavaScript…
- immigrantheart 4y agoThere is no company in this world that can avoid JavaScript.
- gardenhedge 4y agoAwesome. The homepage explains it very well which is impressive.
- latchkey 4y agoDefinitely beta, but really awesome to see someone working on this stuff. "I spent most of the day on a memory leak. Probably going to just ship with the memory leak since I need to invest more in docs. It starts to matter after serving about 1,000,000 HTTP requests from web streams" https://twitter.com/jarredsumner/status/1543236098087825409 https://twitter.com/jarredsumner/status/1543236098087825409
- pverghese 4y agoWhat's your point with pointing this out without any comment. Are you trying to be snarky?
- stevage 4y agoI read it as a useful caveat. And also an interesting example of transparency.
- nicce 4y agoHe gave an example about awesomeness. Someone going so deep into something which matters just in a rare scenario?
- pverghese 4y agoTheir reply was edited to include the first line. When I replied it was just the quote and no context
- latchkey 4y agoI only added the additional note after the , to clarify that it is still cool stuff, even if it is beta and has memory leaks. At least in my usecase, I do about 35m hits / day... so this would fall over in less than an hour. 1m isn't that large of a number and the author is willing to shrug that off until after launching.
- 4y ago
- mwcampbell 4y agoThe benchmark numbers for React server-side rendering are really impressive. How does bun manage to be so much faster, especially considering that React SSR is actually fairly compute-intensive (building up a DOM tree and all)?
- leeoniya 4y agomaybe it's bottlenecked on Node's built-in http module, there are projects like uWebSockets.js (and hyper-express [1] built on top of it) [1] which show a 10x increase in throughput. [1] https://github.com/kartikk221/hyper-express/blob/master/docs/Benchmarks.md https://github.com/kartikk221/hyper-express/blob/master/docs...
- mhh__ 4y agoGaming benchmarks is pretty easy if you have a very repetitive task. A good compiler developer should be able to make his or her compiler best everyone else one one benchmark
- remorses 4y agoOne optimization he made is inlining jsx createElement calls
- wpnx 4y agoCongrats Jarred :) It's been fun watching you build this over the last year on Twitter. Cheers to much success
- akagusu 4y agoBun won my heart because: - it uses Zig and not Rust - it uses JavaScriptCore and not V8 - it has built-in support for my favorite database: sqlite - it is all-in-one
- sedatk 4y agoWhat do you have against Rust?
- deleted 4y ago[deleted]
- k__ 4y agoHaha, good question. Should have used Nim, to make it interesting :D
- aidaman 4y agotoo complicated
- mr90210 4y agoThe whole rewrite everything in Rust.
- crabbygrabby 4y agoThat's mostly a thing teenagers are doing to learn CS, when it's not it's because the software is vulnerable or slow and benefits from a rewrite in a safe language.
- jokethrowaway 4y agoRewriting into a safe language actually has some benefits - namely safety compile time guarantees. Only RAM manufacturers like memory leaks.
- Cthulhu_ 4y agoWhile true, I think there's a lot of "this is better because it's been written in Rust" software around these days. The emphasis is on the language, not the problem being solved.
- wildifire01 4y agoCongrats on Bun v0.1, Jarred. I've been waiting for this day for the past 11 days: :) https://twitter.com/jarredsumner/status/1540340884113223680 https://twitter.com/jarredsumner/status/1540340884113223680 Could you share what made you choose Zig over V for the project? It looks like both languages would have been an appropriate choice.
- pverghese 4y agoV's memory management is a mess. Zig enables a lot easier fine tuning of memory
- deleted 4y ago[deleted]
- mikojan 4y agoI absolutely loathe npm ci when checking out another branch. It is slow. Anybody know how bun (or any other package manager) stacks up to it?
- jmull3n 4y agopnpm is much better. https://pnpm.io/ https://pnpm.io/
- tambourine_man 4y agoI’m always flabbergasted how often projects, including and especially the ones dealing with web technologies (JavaScript), fail to write a responsive website. https://imgur.com/a/1yrgHR4 https://imgur.com/a/1yrgHR4
- jmull 4y agoIt’s working well on my phone.
- deleted 4y ago[deleted]
- pdanpdan 4y agoYou could be more impressed that some web pages manages to guess that the browser you use, that presents itself as a desktop browser, is in fact a mobile browser :)
- tambourine_man 4y agoMine is not presenting itself as a desktop browser. It just has a smaller screen than what the designer expected. iPhone SE
- Hamcha 4y agoI want to love this so much, kinda sad that Windows support is non-existant outside of WSL (which I try to use as a last resort option). I love the bundling of most tasks in one app, especially in an environment where I had friends refuse to interact because of the "framework of the month" problem. I just wish it din't rep Zig this much, I'm hyped for Zig as much as the next guy, but the website mentions is twice back to back and I really think we should stop going "it's better cause it's written in X".
- AndyKelley 4y agoIt's not enough to build something great if nobody knows about it. Marketing is just as important to the success of a project as engineering. By giving such a generous shoutout to Zig, complete with a call for donations, Jarred has effectively created a symbiotic relationship with the Zig project, a win-win situation where both projects are boosted up by each others' spotlights.
- cercatrova 4y agoThank you for creating Zig.
- Hamcha 4y agoA shoutout is very appreciated and putting Zig in the title line definitely is what caught my interest (so yes Zig is being used to promote bun probably more than bun is promoting Zig at this point) but the writing specifically on the website is a bit on the nose, don't you think? "Why is Bun fast? Because of Zig" Rust is already somewhat infamous for this ("Rewrite it in Rust" is a meme) and has caused it to develop a bit of a stigma, at least in my circles. I'm still rooting for Zig to get its place among the big ones (and bun seems definitely a nice way to push for it) I just hope that happens without creating the annoying cult-like behaviors that plagued the crab language.
- kristoff_it 4y agoBun relies on Zig and Zig is an unfinished product that relies on donations to survive. A shout-out to Zig is not only a nice gesture but also a smart one, since it's in Bun's best interest for Zig to survive at least until v1. The general concern about "written in Zig" being annoying is fair. I think it's a different beast when paired with a call to donate but regardless, if RIIZ is what worries you most, then you can sleep safe because our motto is "Maintain It With Zig", a conscious rejection of "Rewrite It in *". https://kristoff.it/blog/maintain-it-with-zig/ https://kristoff.it/blog/maintain-it-with-zig/
- swyx 4y agolivestreamed 2hrs of running through basic tasks with bun: https://www.youtube.com/watch?v=VFKQvdWwuxw https://www.youtube.com/watch?v=VFKQvdWwuxw Pain points - no docs on deploying bun (failed to do it on Fly.io or Railway.app, much less Netlify or Vercel) - lack of api reference right now - got a segfault when building a React SSR server
- andsoitis 4y ago"New levels of performance (extending JavaScriptCore, the engine)." I excitedly thought this project might include a new JavaScript VM, not extending an existing one.
- throwawaymaths 4y agoAt this rate Just give jarred another 2 years
- crabmusket 4y agoWhat would you like to see from a new JS VM?
- oorza 4y agoDo you just want a wish list? How about configurable garbage collectors, cacheable JIT outputs, or a standardized bytecode format to facilitate language interop?
- crabmusket 4y agoThose are great points. I asked because I have seen people get excited about new JS runtimes a lot when Deno came out, and not understanding that it was using V8 under the hood. So many people thought they wanted a "new TypeScript runtime" that would "compile to WASM" without really thinking through how that would work or what it would be. Spoilers: it would work the same as V8. But thanks for those specific wishlist items, which are much more sensible! Isn't your last item WASM though, with its interface types proposal?
- noduerme 4y agoThis sounds extremely impressive! One question: Most of my nodejs code relies heavily on a custom wrapper I built around node-mysql ... for some rather complicated historical reasons, not node-mysql2. In general, what database modules are supported out of the box (besides sqlite3)?
- 8n4vidtmkvmk 4y agotry mysql3! j/k. i wrote it so I'm biased but it hasn't seen much use outside my projects
- noduerme 4y agoheh. I understand. No one uses mine either. I wrote it around the core to cache server-side prepared statements and old PDO style bindings (WHERE `field`=:var) I will check yours out if you post a link! or is it just node-mysql3?
- 8n4vidtmkvmk 4y agohttps://www.npmjs.com/package/mysql3 https://www.npmjs.com/package/mysql3 It's main selling point is that it uses template strings so you can just do sql`select f from t where x=${somevar}` And the lib will take care of escaping somevar. I was getting sick of ORMs which make it even harder to write complex queries. It's just a wrapper over mysql1 or 2. I forget which
- aledalgrande 4y agowonder if bun also has a different approach to security when it comes to installing packages and running their scripts and/or using file system at runtime, e.g. not giving access to the whole machine's file system like Node?
- viginti_tres 4y agoWas trying to benchmark bun but after 2 minutes it stuck in typescript [1342/1364]. Running on M1 Mac, nextjs project. I think i'm still going to stick pnpm
- Linda703 4y ago[dead]
- radicalriddler 4y agoIs bun.sh (the website) open sourced? It says it was built with bun, anyone have a link?
- radicalriddler 4y agoFor anyone else looking, https://github.com/Jarred-Sumner/bun/tree/main/packages/bun-landing https://github.com/Jarred-Sumner/bun/tree/main/packages/bun-...
- adamddev1 4y agoThis looks really, really good! Does it (have plans to) support TCO (tail-call optimization)?
- txdv 4y agohttps://webkit.org/blog/6240/ecmascript-6-proper-tail-calls-in-webkit/ https://webkit.org/blog/6240/ecmascript-6-proper-tail-calls-... looks like javascriptcore has it
- adamddev1 4y agoThat's great, but PTC not quite the same thing as TCO. (As the blog post says). Too bad it doesn't seem any big players in JavaScript ar moving to implement that.
- toastal 4y agoIt's a shame proprietary Discord is their only communication option, and proprietary GitHub their only Git mirror. They're even advertising the Discord in the CLI (https://github.com/Jarred-Sumner/bun/blob/e4fb84275715bb4de4b541f6de0ede4b5ce3e10a/src/cli/discord_command.zig https://github.com/Jarred-Sumner/bun/blob/e4fb84275715bb4de4...). Also the shorthand syntax `bun create github-user/repo-name destination` is favoring users choosing GitHub above others instead of not favoring any specific Git forge (the best path I've seen is how nixpkgs supports github:u/repo gitlab:u/repo sourcehut:~u/repo etc. to shorthand popular options but not favoring any, while still being flexible enough to continue extending).
- crabmusket 4y agoEven Go's famously-derided "package management" used full URLs like `import "github.com/user/repo"`
- toastal 4y agoThe Vim plugin communities are notorious about the GitHub bias too with almost everything just assuming GitHub. npm is supports shorthands for some Git forges (though no SourceHut or Codeberg), but without the `forge:` syntax, you get GitHub as the default which is also favoritism (no surprise with Microsoft owning GitHub and npm though). The worst offender IMO though is Elm who ties their entire package management ecosystem to GitHub where both your identity and the ability to upload a package requires a GitHub account and hosting must be there too, and downloading requires that GitHub's servers are actually up (with the community needing hacks to deal with the non-so-uncommon likelihood of GitHub being down and no way to point to a mirror).
- tasubotadas 4y agoWhy is a proprietary communication tools is a problem? What's next? It's gonna be a shameful practice to use windows for development?
- toastal 4y ago> Why is a proprietary communication tools is a problem? You're signaling to all contributors that you don't value their freedom or privacy. Not everyone wants to give their data to a corporation. Some users have accessibility needs that straight aren't met by Discord's clients and they send cease-and-desists to every attempt at people to try to make a better or safer alternative client experience free of charge. The fact that there are free and libre alternatives, but choosing not use or at least support an alternative alongside shows your project's priorities (see: Libera.Chat, mailing lists, Matrix, Zulip, Fediverse, RSS/Atom feeds, hosting Discourse, et. al.). > What's next? It's gonna be a shameful practice to use windows for development? Slippery nope.
- pjmlp 4y ago> Bun.js uses the JavaScriptCore engine, which tends to start and perform a little faster than more traditional choices like V8 So it isn't really everything written in Zig and there is some C++ helping there, actually.
- hu3 4y agoZig supports C/C++ cross-compilation out-of-the-box so the integration with JavaScriptCore is at the very least facilitated by Zig.
- pjmlp 4y agoStill isn't Zig. Using the same reasoning I can assert having written a JavaScript runtime in e.g. F# by making use of C++/CLI to compile JSC.
- hu3 4y agoWhat's the point of your comment? They don't claim it's pure Zig and even mention JavaScriptCore in their front page.
- pjmlp 4y ago> Bun: Fast JavaScript runtime, transpiler, and NPM client written in Zig Definitely reads otherwise and is click bait, given the actual implementation.
- cweagans 4y agoI'm not really sure what your argument is. It sounds like you're complaining that he used a library to handle the actual javascript parsing/evaluation. There are still platform-specific things that need to be implemented and plugged in to the JS environment to be able to do anything useful (for instance, starting up a server and binding to a port isn't something that the OOTB JavaScriptCore sandbox is going to let you do - you have to implement that separately and plug it in yourself). The transpiler and npm client are completely separate things. If you read "runtime" as "extensions that allow you to do actually useful stuff" instead of "parser/evaluator", I don't see an issue.
- nojvek 4y agoThis is great. Does bun handle yarn.lock files and create them? I.e - can I replace yarn/npm with bun 1:1 for the speed gains? I also wonder how bun compares to esbuild for js/ts transpile speed gains?
- lioeters 4y agoWhat an ambitious project, I love it. > Longer-term, bun intends to replace Node.js, Webpack, Babel, yarn, and PostCSS (in production). https://github.com/Jarred-Sumner/bun#limitations--intended-usage https://github.com/Jarred-Sumner/bun#limitations--intended-u...
- wonderbore 4y agoI love these super-ambitious projects (see Parcel, Rome.js) because after several years they will still fail in many areas at once! > Rome is a formatter, linter, bundler, and more for JavaScript, TypeScript, JSON, HTML, Markdown, and CSS. > Rome is designed to replace Babel, ESLint, webpack, Prettier, Jest, and others. Haven't seen it since. > Parcel: The zero configuration build tool for JavaScript, CSS, HTML, TypeScript, React, images, SASS, SVG, Vue, libraries, Less, CoffeeScript, Node, Stylus, Pug, Electron, Elm, WebGL, extensions, GraphQL, MD As long as you do the bare minimum for each target.
- jokethrowaway 4y agoparcel is great, I always use it for personal project and it works pretty well Normally I start with something else (webpack, rollup, whatever happened to be there with the example I'm starting from), then when I hit some roadblocks I just parcel index.html and I have something working.
- wonderbore 4y agoParcel is great, until it isn’t. I regularly try to switch to Parcel and it’s just impossible on larger projects. If you start with parcel, great! (maybe, as long as you just need to bundle 2 modules and that’s it)
- paulhodge 4y agoOne of the things that makes frontend dev a nightmare is having to wrangle so many different tools and configurations to build a site, even a simple one. The only next step to improve the situation is all-in-one tools. We're lucky that people are trying to tackle this hard problem.
- angelmm 4y agoImpressive work here. Congrats Jarred for the lunch of Bun! I'm eager to see how the different runtimes will shine in the edge side. Bun is clearly positioned as one option and the focus on this is stated in the main page. I believe the traction for Bun will depend a lot of the adoption. I see the point on having the fastest(TM) runtime in Linux and MacOS, but that comes from the fact of using specific syscalls. If we move to the edge, it's not clear to me how this will be implemented. Maybe those syscalls are not available or sandboxing makes things for difficult. The requirements for making it compatible may reduces its performance. We will see :)
- tipiirai 4y agoCongratulations! This is one of those epic projects you only get to see only few times on your career. Potential/hopeful game changer. Like jQuery or Node. I'd like to know more about the bundled .bun files. What are they? How they are used? Usable on the browser too?
- brillout 4y agoHatTip [1] just added preliminary Bun support [2]. (HatTip: write universal server code that runs anywhere: Node.js, Edge, Deno, Bun, ... Also for library authors who want to provide a middleware that works anywhere, instead of locking their users into a single JS server runtime.) @Jarred: We'd be curious to know what you think of HatTip! [1]: https://github.com/hattipjs/hattip https://github.com/hattipjs/hattip [2]: https://github.com/hattipjs/hattip/tree/feat/bun https://github.com/hattipjs/hattip/tree/feat/bun
- vaughan 4y agoAny plans for desktop? An Electron replacement would be nice.
- picozeta 4y agoNice, but using a memory unsafe language in a web context is too risky in my opinion.
- Etheryte 4y agoDoes that mean you also avoid using Chrome, Firefox, Node, etc?
- picozeta 4y agoNo, because I have to. But there are many capable languages to develop memory save web applications (Haskell, Go, Rust, Java, Python, TypeScript, Elm, Clojure, ...), so why would one choose one that's not save?
- Etheryte 4y agoFor starters, Go is not even memory safe. That aside, there are many reasons to choose a different language, memory safety is only one of very many tradeoffs that you make when choosing your tooling. In Bun's example, extreme performance has been achieved which no comparable alternative provides. Neither performance nor memory safety are "better" or "worse" by themselves, it's a matter of which tradeoffs you choose.
- postalrat 4y agoDid you want to say (Rust) but felt compelled to list more? Can Java, Python, Typescript, Elm, or Clojure even be consider memory safe since they are run on VMs or interpreters that might not be memory safe?
- rcarmo 4y agoNeat. Anyone try it on ARM yet? I’m interested in 32 bit ARM, but 64 will do too.
- newbieuser 4y agoat first glance it looks like a more developer friendly tool compared to deno
- deleted 4y ago[deleted]
- inglor 4y agoHey, excited to see more players in this space and more alternatives which I believe is a win for users. If there is anything Node core can do better for you to allow better interop ping us. Also - I'm not sure if you're involved with the WinterCG stuff (I _think_ maybe?) but if you're not please come by!
- christophilus 4y agoJust took it for a spin w/ SQLite. Pretty nice that it's got TypeScript support and SQLite support out of the box with no dependencies. The same project in Node pulled in over 100 dependencies and was about 1/3 as fast (super basic HTTP endpoint serving 2 rows of data). Bun performed roughly on par with Go. Again, a trivial test, but pretty exciting, nonetheless.
- norswap 4y agoIs JavaScriptCore really faster than V8 in general?
- skavi 4y agoYup, at least according to Speedometer 2.0.
- ksec 4y agoIf there was one comment or tweet that lead me to follow him, it was this [1] "1ms is an eternity for computers" When was the last time you heard a Web Developer, frontend, backend or web tooling Dev state that? [2] It is always, oh the network latency dominate, or the DB response time dominate. It is only one tenth of a second ( 100ms ) it doesn't matter. It is fast enoughTM. [1] https://twitter.com/jarredsumner/status/1477775398700158980 https://twitter.com/jarredsumner/status/1477775398700158980 [2] Actually Nick Craver does that a lot during his StackOverflow era.
- lewispollard 4y agoMore web developers need to try out game development, it's a similar enough domain in terms of rendering UI and being responsive, but there's absolutely no tolerance for the kind of time wastage that web developers seem to accept as a given.
- Cthulhu_ 4y agoIt's because the web developer is so far removed from the hardware; we work in Typescript, which is transpiled to Javascript, which is minified, optimized and compressed before it's sent to the browser, where it's run in a JS engine in a browser in an operating system where there's a few more steps to the actual hardware. And that's plain JS, most people don't even work in plain JS but in a framework where they don't just say "var x = y" but "publish this event into my Observable stack which triggers a state update which will eventually, somehow, update my component which will then eventually update the DOM in the browser", after which the browser's own whole stack of renders takes over. Meanwhile in video games you can say `frame[0][0] = 255` to set a pixel to white, or whatever. I think it's a matter of levels of abstraction; with webapps, I'd argue they've gone even further than Java enterprise applications in the 90's / 2000's.
- AtNightWeCode 4y agoImpressive. I have to say that. Performance is one thing (the benchmarks are probably wrong though), but will it solve any of the headache you get with NodeJS. I for instance have 7 different NodeJS versions installed just to compile all the projects I use. Oldest version is currently 6(!). The NPM dependency hell is best in class. NodeJS LTS is nothing but a tag. Compliance with ECMAScript updates have not been great. Still a mess with NodeJS to figure out if a package will work on the specific version. Still poor performance in comparison to other tech. And so on...
- atom_arranger 4y agoThere will always be incompatibilities between versions. Ideally the tool would manage its own version, maybe with vendoring. Yarn does this optionally and it works well At least with this you wouldn’t need to manage versions of the package manager and runtime separately
- AtNightWeCode 4y agoWell, I can't even run npm install on latest NodeJS LTS version. So, I can't even install yarn to begin with. npm ERR! Unexpected token '.'
- yboris 4y agoMildly related: dum - https://github.com/egoist/dum https://github.com/egoist/dum dum replaces npm run and npx. Instead of waiting 200ms for your npm client to start, it will start immediately.
- KenTG 4y agoNice!
- mrtweetyhack 4y ago