[ruby-core:123836] [Ruby Feature#21695] Optimizing Ruby performance with Ruby itself instead of Rust
Issue #21695 has been reported by fredlinhares (Frederico Linhares). ---------------------------------------- Feature #21695: Optimizing Ruby performance with Ruby itself instead of Rust https://bugs.ruby-lang.org/issues/21695 * Author: fredlinhares (Frederico Linhares) * Status: Open ---------------------------------------- I am using ERB on top of C for a game I am making now. We can use the tool to improve the productivity, memory safety, and runtime speed for Ruby. It can also replace a Rust JIT compiler for better results. The only problem is that it requires some level of manual memory management, while Rust does it all for you. If I demonstrate that it is better than Rust in practice, would you be willing to incorporate it into the Ruby language? I want to know because making it more generic will require more effort from me; if you are not interested, I won’t make the tool public. -- https://bugs.ruby-lang.org/
Issue #21695 has been updated by matz (Yukihiro Matsumoto). I am interested. What kind of API do you need? Since bare memory allocation could break the whole app (leads to DoS), it's not that easy to disclose general purpose memory allocation (that's the reason YJIT, RJIT etc. has their own allocators), but there might be the way to satisfy your version of performance improvement. Matz. ---------------------------------------- Feature #21695: Optimizing Ruby performance with Ruby itself instead of Rust https://bugs.ruby-lang.org/issues/21695#change-115238 * Author: fredlinhares (Frederico Linhares) * Status: Open ---------------------------------------- I am using ERB on top of C for a game I am making now. We can use the tool to improve the productivity, memory safety, and runtime speed for Ruby. It can also replace a Rust JIT compiler for better results. The only problem is that it requires some level of manual memory management, while Rust does it all for you. If I demonstrate that it is better than Rust in practice, would you be willing to incorporate it into the Ruby language? I want to know because making it more generic will require more effort from me; if you are not interested, I won’t make the tool public. -- https://bugs.ruby-lang.org/
Issue #21695 has been updated by Eregon (Benoit Daloze). What are you proposing exactly? A "tool" is very vague. Do you mean a JIT compiler for Ruby written in Ruby? Something else? Are you interested in speeding up ERB specifically, or Ruby in general? Why do you think it would achieve better results than a JIT compiler for Ruby written in Rust? (I think the language in which a JIT is written has little impact on the performance of emitted code, but it matters a lot more for startup/warmup) Regarding manual memory management, can't you use Fiddle or FFI which already provides that? ---------------------------------------- Feature #21695: Optimizing Ruby performance with Ruby itself instead of Rust https://bugs.ruby-lang.org/issues/21695#change-115248 * Author: fredlinhares (Frederico Linhares) * Status: Open ---------------------------------------- I am using ERB on top of C for a game I am making now. We can use the tool to improve the productivity, memory safety, and runtime speed for Ruby. It can also replace a Rust JIT compiler for better results. The only problem is that it requires some level of manual memory management, while Rust does it all for you. If I demonstrate that it is better than Rust in practice, would you be willing to incorporate it into the Ruby language? I want to know because making it more generic will require more effort from me; if you are not interested, I won’t make the tool public. -- https://bugs.ruby-lang.org/
Issue #21695 has been updated by fredlinhares (Frederico Linhares). Currently, my goal is to rewrite the C++ code I have into C. To achieve this, I am creating a set of macros in Ruby on top of C that run at compile time, and the output of these macros is C code. Here is an example of what I am doing, code goes from this: ``` <%= scope do %> <%= var :my_texture, Game::Texture("img/some_texture.qoi") %> render(my_texture) <% end %> ``` to this: ``` { Texture my_texture; Texture_constructor(&my_texture, "img/some_texture.qoi"); render(my_texture); Texture_destructor(&my_texture); } ``` When I create a Ruby variable, it tracks everything; this way, the tool (I have no name for it yet) can, for example, automatically add a destructor when needed. Since you are interested, I will move my code to a gem and post the link here. ---------------------------------------- Feature #21695: Optimizing Ruby performance with Ruby itself instead of Rust https://bugs.ruby-lang.org/issues/21695#change-115267 * Author: fredlinhares (Frederico Linhares) * Status: Open ---------------------------------------- I am using ERB on top of C for a game I am making now. We can use the tool to improve the productivity, memory safety, and runtime speed for Ruby. It can also replace a Rust JIT compiler for better results. The only problem is that it requires some level of manual memory management, while Rust does it all for you. If I demonstrate that it is better than Rust in practice, would you be willing to incorporate it into the Ruby language? I want to know because making it more generic will require more effort from me; if you are not interested, I won’t make the tool public. -- https://bugs.ruby-lang.org/
participants (3)
-
Eregon (Benoit Daloze) -
fredlinhares (Frederico Linhares) -
matz (Yukihiro Matsumoto)