# Update Gemfile fast\_xor platform to :ruby

**URL:** https://meta.discourse.org/t/update-gemfile-fast-xor-platform-to-ruby/159064
**Category:** Development
**Created:** [July 28, 2020, 2:41pm UTC](https://meta.discourse.org/t/update-gemfile-fast-xor-platform-to-ruby/159064 "2020-07-28T14:41:43Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![bjfish](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bjfish/32/188318_2.png) [@bjfish](https://meta.discourse.org/u/bjfish)
#### Post date: [July 28, 2020, 2:41pm UTC](https://meta.discourse.org/t/update-gemfile-fast-xor-platform-to-ruby/159064/1 "2020-07-28T14:41:44Z")

</div>

The fast\_xor platform is listed as :mri. However, this gem appears to require C extensions but it is not specific to MRI: [discourse/Gemfile at 0c7eaa57b26a22b0d0f85957ce0720be748d1fe6 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/0c7eaa57b26a22b0d0f85957ce0720be748d1fe6/Gemfile#L82)

I have also confirmed this works on the latest TruffleRuby.

Could you please update the platform to :ruby?

For reference, here is a list of meanings for difference platforms:

> **[Platforms - Bundler: gemfile](https://bundler.io/man/gemfile.5.html#PLATFORMS)**
>
> Gemfile - A format for describing gem dependencies for Ruby programs

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 29, 2020, 7:10am UTC](https://meta.discourse.org/t/update-gemfile-fast-xor-platform-to-ruby/159064/2 "2020-07-29T07:10:13Z")

</div>

Sure I just too care of this there are a few others I left which I am unsure about, what should I do with them? (byebug, ruby-prof, better\_errors, rbtrace, gc\_tracer, stackprof, memory\_profiler)

That said we are totally blocked on truffle till we get mini\_racer working per:

[https://github.com/oracle/truffleruby/issues/1827](https://github.com/oracle/truffleruby/issues/1827)

Discourse is not really properly functional if you can not cook Markdown to HTML on the server.

---

<div class="post-metadata">

### Author: ![eregon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eregon/32/188324_2.png) [@eregon](https://meta.discourse.org/u/eregon)
#### Post date: [July 29, 2020, 4:03pm UTC](https://meta.discourse.org/t/update-gemfile-fast-xor-platform-to-ruby/159064/3 "2020-07-29T16:03:28Z")

</div>

Thanks, [DEV: change platform mri to platform ruby on some gems · discourse/discourse@620c223 · GitHub](https://github.com/discourse/discourse/commit/620c223d50bdaa776169574a7d376f056f9dec1c) looks good.

`unicorn` will likely not work on TruffleRuby because it relies on `fork` but actually it installs.

Can Discourse run on Puma instead, any configuration needed for that?

> there are a few others I left which I am unsure about, what should I do with them? (byebug, ruby-prof, better\_errors, rbtrace, gc\_tracer, stackprof, memory\_profiler)

Yes those all seem very MRI-specific (until they start supporting different backends), so best as `platforms: :mri` for now.  
`better_errors` might work, but `binding_of_caller` does not support TruffleRuby yet.  
These gems also seem mostly debugging/performance tools which don’t seem necessary to get the app running.

Yes, we need to look at `mini_racer`.

I wonder, for context, why is JS used to render Markdown?  
To make sure it’s exactly the same result as when run in the client browser?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 29, 2020, 4:47pm UTC](https://meta.discourse.org/t/update-gemfile-fast-xor-platform-to-ruby/159064/4 "2020-07-29T16:47:04Z")

</div>

> [@eregon](#):
>
> Can Discourse run on Puma instead, any configuration needed for that?

In development a simple `rails server` will use puma.

> [@eregon](#):
>
> I wonder, for context, why is JS used to render Markdown?  
> To make sure it’s exactly the same result as when run in the client browser?

Yes. Now that [wasm](https://github.com/wasmerio/ruby-ext-wasm) exists it may be a way out, but it would be a very big change to keep it as extensible by plugins as it is today.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 30, 2020, 12:39am UTC](https://meta.discourse.org/t/update-gemfile-fast-xor-platform-to-ruby/159064/5 "2020-07-30T00:39:14Z")

</div>

> [@Falco](#):
>
> Yes. Now that [wasm](https://github.com/wasmerio/ruby-ext-wasm) exists it may be a way out

wasm would definitely be off the table here, payload would be much bigger, there are tons of security issues around getting it to run right with CSPs (and CORS concerns), the implementation of [markdown.it](https://github.com/markdown-it/markdown-it) is spectacularly fast and extensible allowing for tons of plugins and a huge existing ecosystem.

Just some more context on mini\_racer. From day 0 at Discourse we insisted on a single pipeline to cook markdown, this completely eliminated a very nasty class of bugs I have experienced at Stack Overflow where server and client spoke slightly different dialects. For Discourse this is even more important cause plugins can amend the pipeline. For example:

◀ is implemented in a plugin (parsing of `[]`)

> [@eregon](#):
>
> Can Discourse run on Puma instead, any configuration needed for that?

We have quite a few “quality of life” features we get by using unicorn and relying on forking, see:

> <https://github.com/discourse/discourse/blob/620c223d50bdaa776169574a7d376f056f9dec1c/config/unicorn.conf.rb>

Specifically we monitor and manage a sidekiq child process from the master process.

But… truffle has no GIL, puma is already in the Gemfile once we have mini\_racer working, we could collaborate on memory conserving truffle setup that keeps sidekiq and puma in the same process. Or people could just spawn a sidekiq process by hand. Puma can certainly work, we make use of Rack.hijack extensively but that is implemented across Puma/Unicorn/Passenger already.

---

<div class="post-metadata">

### Author: ![volanar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/volanar/32/318163_2.png) [@volanar](https://meta.discourse.org/u/volanar)
#### Post date: [August 21, 2022, 7:51pm UTC](https://meta.discourse.org/t/update-gemfile-fast-xor-platform-to-ruby/159064/6 "2022-08-21T19:51:22Z")

</div>

mini\_racer 0.6.3 works on TruffleRuby now 🎉
