Re:Implementing a simple object system from scratch in Ruby
by metacircu1ar on Sunday December 15, 2024 @09:09AM
(#42423451)
Thanks for spotting this. The parts of code were written at different times. I'll fix this to standardize on :key => value form, as I want symbols to be clearly distinguishable both on call sites and in the method table.
Re:Implementing a simple object system from scratch in Ruby
by caseyohara on Sunday December 15, 2024 @10:01AM
(#42423761)
You should know that using the hash rocket syntax has not been idiomatic Ruby since the new hash syntax was introduced in 2012. Unless your keys are not symbols, there’s no reason to use hash rockets.
Re:Implementing a simple object system from scratch in Ruby
by uticus on Sunday December 15, 2024 @09:38AM
(#42423613)
You are correct technically, but the implication that you must sacrifice speed or static typing is practically incorrect: faster on startup than .NET [0]. You can get benefits similar to static typing in for a while now [1].
Re:Implementing a simple object system from scratch in Ruby
by neonsunset on Sunday December 15, 2024 @10:56AM
(#42424084)
> faster on startup than .NET [0]
This is unlikely. When you invoke 'dotnet run' you're essentially going through the entire build system, it doesn't "just" launch the application - it also builds it or verifies that it doesn't need to.
The actual startup time for compiled applications is <100ms for JIT (sometimes even <50ms) and ~10ms for AOT.
Feel free to verify this with:
dotnet new console --aot
dotnet publish -o .
hyperfine ./{name of the program}
(make sure to use up-to-date version of the SDK, can be installed with sudo apt install dotnet9 / brew install dotnet)
it might not be the fastest or the strictest, but man is it expressive
[0] tested locally on a Linux environment
[1] https://github.com/ruby/rbs#readme
This is unlikely. When you invoke 'dotnet run' you're essentially going through the entire build system, it doesn't "just" launch the application - it also builds it or verifies that it doesn't need to.
The actual startup time for compiled applications is <100ms for JIT (sometimes even <50ms) and ~10ms for AOT.
Feel free to verify this with:
(make sure to use up-to-date version of the SDK, can be installed with sudo apt install dotnet9 / brew install dotnet)Of course performance of the code itself is going to have more than an order of magnitude of difference: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
Please share.
fwiw
C# aot in-process timing (0.029) about 0.005 faster than process timing.
Ruby yjit in-process timing (1.565) about 0.083 faster than process timing.
https://benchmarksgame-team.pages.debian.net/benchmarksgame/...