13 ms·
Artichoke is a Ruby made with Rust that compiles to WebAssembly
- mickallen 6y agoAre there any performance benefits over MRI?
- jtstanley 6y agoThe talk at rubyconf mentioned that `string.scan` was 100% faster due to specialized string implementations in the Rust backend. I wonder if there are any performance gains from the actual runtime rather than from std optimizations?
- spullara 6y ago100% faster? Does that mean twice as fast or is string.scan now take 0 time?
- ibraheemdev 6y ago100% faster means speed is increased by 100%, i.e. double the speed or half the time. MRI took 89ms/iter to scan for a regex pattern over 6.8MB of text, while Artichoke took 48ms/iter [0] 0: https://youtu.be/QMni48MBqFw?t=1378 https://youtu.be/QMni48MBqFw?t=1378
- jonnytran 6y agoThat is misleading, in my opinion. "100% faster" implies that runtime for a given workload is reduced by 100%, taking zero time. I think what you mean to say is either that it's 50% faster or that throughput is increased by 100%.
- Tistron 6y agoSurely faster means higher speed, and speed is something per time unit, e.g. miles per hour, or number of scans per second. At least for me 100% faster does not mean the same as 100% less time was needed.
- chrisseaton 6y agoI don't think it runs Optcarrot (the current most prominent Ruby benchmark) otherwise it'd be listed here https://github.com/mame/optcarrot https://github.com/mame/optcarrot. It doesn't have a lot of compatibility with standard Ruby yet according to https://eregon.me/blog/2020/06/27/ruby-spec-compatibility-report.html https://eregon.me/blog/2020/06/27/ruby-spec-compatibility-re... which could be why it doesn't run it. But it's a really exciting project!
- hamburglar 6y agoNot sure how far off this is, practically speaking, but "true parallelism with no GIL" would be a pretty damn significant perf achievement.
- jtstanley 6y agoThe use of traits here is really cool. It looks like the entire language implementation is defined as a trait, which allows for language backends to be swapped out while maintaining the same outward API.
- p4lindromica 6y agoThanks for catching this. That is spot on. These APIs in the `Symbol` backend [0] show this concept off really well I think. The `Symbol` data structure knows how to, e.g. render its `Symbol#inspect` implementation [1]. To extract the underlying bytes associated with the `Symbol`, however, it needs an interpreter. But not a whole interpreter or any particular interpreter, just one that implements `Intern` [2]. All of these generics get monomorphized so there are no vtables or other indirection. Because it's unlikely you'll have more than one interpreter implementation in your program, there is no code bloat either. [0]: https://github.com/artichoke/artichoke/blob/2d67d8537c1340f1f4981ca19a956d70d25ae585/spinoso-symbol/src/lib.rs#L239-L326 https://github.com/artichoke/artichoke/blob/2d67d8537c1340f1... [1]: https://artichoke.github.io/artichoke/spinoso_symbol/struct.Inspect.html https://artichoke.github.io/artichoke/spinoso_symbol/struct.... [2]: https://artichoke.github.io/artichoke/artichoke_core/intern/trait.Intern.html https://artichoke.github.io/artichoke/artichoke_core/intern/...
- dwheeler 6y agoArtichoke is interesting, but it's still really young and doesn't have a lot of compatibility with MRuby yet: https://eregon.me/blog/2020/06/27/ruby-spec-compatibility-report.html https://eregon.me/blog/2020/06/27/ruby-spec-compatibility-re... I don't know of any reason it can't grow to be much more compatible. There's a 2019 video about Artichoke: https://www.youtube.com/watch?v=QMni48MBqFw https://www.youtube.com/watch?v=QMni48MBqFw
- mesaframe 6y agoAll the correct keywords used in the post to make it to the front page of HN.
- faitswulff 6y agoJust missing blockchain (but in a negative light, these days).
- nerdponx 6y agoThey are the correct keywords because HN users are interested in these technologies. I don't see anything wrong with that.
- da_big_ghey 6y agoYeah, I came here thinking the same. Looks like someone made use of that HN title A/B tester posted a few weeks back, maybe. https://www.hacker-ai.com/ https://www.hacker-ai.com/
- ibraheemdev 6y agoNope. The title is just an accurate description of what Artichoke is. Artichoke is an implementation of Ruby made with Rust that compiles to WebAssembly.
- fctorial 6y agohttps://prnt.sc/weiprx https://prnt.sc/weiprx
- conradev 6y agoAll of the correct keywords and 3900 of the correct commits to ago along with them
- blunte 6y agoIt's almost as if a lot of HN readers are interested in Ruby, Rust, and WebAssembly...
- 6y ago
- codeulike 6y agoPeak HN
- p4lindromica 6y agoHi folks, Artichoke author here. I mostly post project updates on Twitter. Here's a selection of some cool things I've been working on recently: - https://twitter.com/artichokeruby/status/1339581223119679493 https://twitter.com/artichokeruby/status/1339581223119679493 - https://twitter.com/artichokeruby/status/1339578582222266368 https://twitter.com/artichokeruby/status/1339578582222266368 - https://twitter.com/artichokeruby/status/1332772105126105089 https://twitter.com/artichokeruby/status/1332772105126105089 - https://twitter.com/artichokeruby/status/1332880679655247872 https://twitter.com/artichokeruby/status/1332880679655247872
- chrisseaton 6y agoIt's a great project thanks for working on it and sharing!
- ksec 6y agoThanks all for working on alternative Ruby Implementation, both Artichoke and TruffleRuby. (Edit: And also JRuby )
- jlrubin 6y agojust curious -- is this project part of your role at stripe or just a (highly polished) side project? I know that Stripe has been investing heavily in better Ruby tooling, e.g., sorbet.
- qwantim1 6y agoThis is so awesome! I can’t wait to try it out! I saw it’s experimental currently, but are you planning on putting a lot of effort into it over the long haul? (I’m unsure whether I should look into it as a viable base for development.)
- notretarded 6y agoWhy should I care? What problem is this designed to solve, or is it another pet project which has grown legs?
- p4lindromica 6y agoYou might want to check out https://github.com/artichoke/artichoke/blob/2d67d8537c1340f1f4981ca19a956d70d25ae585/VISION.md https://github.com/artichoke/artichoke/blob/2d67d8537c1340f1... which lays out the goals for the project.
- jonnypotty 6y agoBecause if that list of languages gets long enough we'll no longer have to do any programming, it'll all be solved.
- ibraheemdev 6y agoIs there a timeline as to when artichoke will be stable enough to say... run a Rails app? Or is that not a goal of this project?
- chrisweekly 6y agoSame question here.
- root_axis 6y agoOut of curiosity, why would you want to do that? Rails just doesn't seem like it makes much sense in the context of WASM. I know you can run WASM outside of the browser but you can run any other ruby outside of the browser, so you wouldn't need artichoke.
- bobthebuilders 6y agoI think it's more of a question of how far along is the project, and is bug-for-bug compatibility a goal or not.
- ibraheemdev 6y agoThere are probably a lot of benefits to be gained from Rails on Wasm. For example, Shopify recently posted an article about how they use Wasm outside of the browser to execute untrusted code (user scripts) [0]. It is also worth mentioning that although Artichoke supports WebAssembly as a build target, compiling to Wasm is not the only way to execute an Artichoke program. 0: https://shopify.engineering/shopify-webassembly https://shopify.engineering/shopify-webassembly
- p4lindromica 6y agoYou might be interested in this early work to build a Sinatra echo server [0] with Artichoke (called ferrocarril back then). `hubris` used a custom Rack-compatible web server called `nemesis` [1] based on Rocket [2], a Rust Flask-like web framework. [0]: https://github.com/artichoke/artichoke/tree/97ba69d31154be455fb89c4e462cf4e2ad800f57/hubris https://github.com/artichoke/artichoke/tree/97ba69d31154be45... [1]: https://github.com/artichoke/artichoke/tree/97ba69d31154be455fb89c4e462cf4e2ad800f57/nemesis https://github.com/artichoke/artichoke/tree/97ba69d31154be45... [2]: https://rocket.rs/ https://rocket.rs/
- pupdogg 6y agoI’m trying to learn more about “artichoke” from their website but the hamburger menu won’t work on my iPhone safari. Pls fix!
- p4lindromica 6y agoFixed [0]. Thanks for the report. The navbar could still use a bit of love though :(. [0]: https://github.com/artichoke/www.artichokeruby.org/pull/171 https://github.com/artichoke/www.artichokeruby.org/pull/171
- pupdogg 6y agoThank you!
- root_axis 6y agoThis is awesome! When the WASM effort was first announced many years ago I happened to be steeped in a ton of ruby work (the ruby/coffeescript era) and had fantasized about the far future when something like this might be a reality... and here it is! These days I don't use ruby much at all, and I use groovy where I might have used ruby (because static types), but I still love the language and admire this effort. Awesome!
- runawaybottle 6y agoJavaScript developers seek their Scala and Kotlin, I suppose. Trying to stop this is like trying to stop your young son/daughter from finding romance. It’s gonna happen one way or another. I just want everyone to be happy and healthy.
- pansa2 6y agoWhat makes Artichoke more suitable than MRI for compilation to WebAssembly (and for embedding, and for single-binary distribution [0])? Is it just that Artichoke is written in Rust? Or does it make different trade-offs in its design? [0] https://github.com/artichoke/artichoke/blob/2d67d8537c1340f1f4981ca19a956d70d25ae585/VISION.md#design-and-goals https://github.com/artichoke/artichoke/blob/2d67d8537c1340f1...
- evolve2k 6y agoVision document here that outlines objectives in detail. https://github.com/artichoke/artichoke/blob/trunk/VISION.md https://github.com/artichoke/artichoke/blob/trunk/VISION.md
- p4lindromica 6y agoHere's a permalink: https://github.com/artichoke/artichoke/blob/939fffc015255736e4f80fee422efdc88af2a620/VISION.md https://github.com/artichoke/artichoke/blob/939fffc015255736...
- deleted 6y ago[deleted]
- niteshade 6y agoThis is amazing! I'd love to see some benchmarks of Artichoke vs Ruby for macOS Homebrew workloads (its mostly the only time the Ruby executable is invoked on my system).