News for hackers. Stuff that matters.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by p4lindromica on Friday January 01, 2021 @02:54PM (#25606261)
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by jlrubin on Friday January 01, 2021 @06:40PM (#25608543)
just 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.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by chrisseaton on Friday January 01, 2021 @03:55PM (#25606986)
It's a great project thanks for working on it and sharing!
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by ksec on Friday January 01, 2021 @04:13PM (#25607217)
Thanks all for working on alternative Ruby Implementation, both Artichoke and TruffleRuby. (Edit: And also JRuby )
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by qwantim1 on Friday January 01, 2021 @07:33PM (#25608931)
This 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.)

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by mesaframe on Friday January 01, 2021 @02:29PM (#25605971)
All the correct keywords used in the post to make it to the front page of HN.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by conradev on Friday January 01, 2021 @05:01PM (#25607661)
All of the correct keywords and 3900 of the correct commits to ago along with them
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by bryanrasmussen on Friday January 01, 2021 @05:28PM (#25607900)
I used to think like you too, but then I looked at the Best of HN for 2020 post https://hn.algolia.com/?dateEnd=1609415804&dateRange=custom&... and I realized there was no Rust or Webassembly or even Ruby or artichokes mentioned there.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by nindalf on Friday January 01, 2021 @05:35PM (#25607954)
I for one am tired of HN constantly upvoting vegetable related posts. Give it a rest folks.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by alfiedotwtf on Friday January 01, 2021 @07:42PM (#25609011)
Imagine 100 years ago on a forum on stage coaches, and automobiles keep getting posted. Yes Rust is the cool new thing, but I don’t see it as a fad. In fact, I see Rust turning into a best practice for our industry unless something like it but easier takes its place
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by pjmlp on Saturday January 02, 2021 @01:26AM (#25610877)
I see managed languages adopting linear and affine types for certain types of high performance workflows.

Already visible in Swift, Haskell, Chapel, ParaSail, D.

Likewise I see Microsoft and Google, will keep their lifetimes efforts going until it offers a good enough experience, even if not perfect, in spite of their ramping up use of Rust.

A good example of this is the Azure Sphere, which inspite of the security marketing story the team tells everywhere with the 7 levels and such, it uses a C based SDK.

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by nerdponx on Friday January 01, 2021 @03:15PM (#25606534)
They are the correct keywords because HN users are interested in these technologies. I don't see anything wrong with that.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by blunte on Friday January 01, 2021 @05:15PM (#25607774)
It's almost as if a lot of HN readers are interested in Ruby, Rust, and WebAssembly...
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by bee_rider on Friday January 01, 2021 @06:57PM (#25608658)
It was a clever trick, though, to start a project using these technologies and work on it for a year, all so that somebody else could post it on HN and get those sweet sweet internet points.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by blunte on Saturday January 02, 2021 @07:25AM (#25612332)
There was a time when a socialite at a party, knowing their audience well, could bring a story of news having just the right delivery to engage most of the others while elevating their own status within the group.

Nothing wrong with it, really, and modern times aren't so different.

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by acheron on Friday January 01, 2021 @11:31PM (#25610397)
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by da_big_ghey on Friday January 01, 2021 @03:26PM (#25606656)
Yeah, 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/
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by ibraheemdev on Friday January 01, 2021 @03:30PM (#25606712)
Nope. The title is just an accurate description of what Artichoke is. Artichoke is an implementation of Ruby made with Rust that compiles to WebAssembly.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by fctorial on Saturday January 02, 2021 @12:39AM (#25610700)
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by faitswulff on Friday January 01, 2021 @03:08PM (#25606439)
Just missing blockchain (but in a negative light, these days).
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by jtstanley on Friday January 01, 2021 @01:57PM (#25605658)
The 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.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by p4lindromica on Friday January 01, 2021 @02:42PM (#25606116)
Thanks 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/2d67d8537c1340f1...

[1]: https://artichoke.github.io/artichoke/spinoso_symbol/struct....

[2]: https://artichoke.github.io/artichoke/artichoke_core/intern/...

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by pansa2 on Friday January 01, 2021 @05:50PM (#25608102)
What 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/2d67d8537c1340f1...

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by root_axis on Friday January 01, 2021 @04:24PM (#25607330)
This 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!

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by dwheeler on Friday January 01, 2021 @02:28PM (#25605950)
Artichoke 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-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

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by evolve2k on Friday January 01, 2021 @09:32PM (#25609739)
Vision document here that outlines objectives in detail.

https://github.com/artichoke/artichoke/blob/trunk/VISION.md

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by p4lindromica on Saturday January 02, 2021 @12:03AM (#25610544)
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by ibraheemdev on Friday January 01, 2021 @03:03PM (#25606369)
Is 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?
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by root_axis on Friday January 01, 2021 @06:34PM (#25608499)
Out 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.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by ibraheemdev on Friday January 01, 2021 @07:10PM (#25608765)
There 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

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by p4lindromica on Friday January 01, 2021 @08:01PM (#25609136)
You 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/97ba69d31154be45...

[1]: https://github.com/artichoke/artichoke/tree/97ba69d31154be45...

[2]: https://rocket.rs/

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by bobthebuilders on Friday January 01, 2021 @06:54PM (#25608640)
I think it's more of a question of how far along is the project, and is bug-for-bug compatibility a goal or not.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by chrisweekly on Friday January 01, 2021 @03:19PM (#25606577)
Same question here.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by mickallen on Friday January 01, 2021 @01:51PM (#25605581)
Are there any performance benefits over MRI?
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by chrisseaton on Friday January 01, 2021 @02:15PM (#25605824)
I don't think it runs Optcarrot (the current most prominent Ruby benchmark) otherwise it'd be listed here 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-re... which could be why it doesn't run it. But it's a really exciting project!
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by jtstanley on Friday January 01, 2021 @01:56PM (#25605640)
The 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?
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by spullara on Friday January 01, 2021 @04:10PM (#25607177)
100% faster? Does that mean twice as fast or is string.scan now take 0 time?
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by ibraheemdev on Friday January 01, 2021 @04:19PM (#25607287)
100% 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

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by jonnytran on Saturday January 02, 2021 @03:14AM (#25611247)
That 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%.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by Tistron on Saturday January 02, 2021 @11:28AM (#25613884)
Surely 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.

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by hamburglar on Friday January 01, 2021 @08:01PM (#25609139)
Not sure how far off this is, practically speaking, but "true parallelism with no GIL" would be a pretty damn significant perf achievement.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by niteshade on Saturday January 02, 2021 @08:33AM (#25612728)
This 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).
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by pupdogg on Friday January 01, 2021 @04:13PM (#25607218)
I’m trying to learn more about “artichoke” from their website but the hamburger menu won’t work on my iPhone safari. Pls fix!
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by p4lindromica on Friday January 01, 2021 @04:25PM (#25607339)
Fixed [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

Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by pupdogg on Friday January 01, 2021 @07:52PM (#25609077)
Thank you!
[dead]
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by p4lindromica on Friday January 01, 2021 @03:10PM (#25606469)
You might want to check out https://github.com/artichoke/artichoke/blob/2d67d8537c1340f1... which lays out the goals for the project.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by jonnypotty on Friday January 01, 2021 @08:37PM (#25609346)
Because if that list of languages gets long enough we'll no longer have to do any programming, it'll all be solved.
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by codeulike on Friday January 01, 2021 @02:35PM (#25606028)
Peak HN
Re:Artichoke is a Ruby made with Rust that compiles to WebAs... by runawaybottle on Friday January 01, 2021 @05:23PM (#25607849)
JavaScript 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.