havenwood changed the topic of #ruby to: Ruby 3.3.0, 3.2.3, 3.1.4 https://www.ruby-lang.org | Rules https://ruby-community.com | Logs https://libera.irclog.whitequark.org/ruby
jenrzzz_ has joined #ruby
Vonter has quit [Ping timeout: 260 seconds]
Vonter has joined #ruby
crespire has quit [Remote host closed the connection]
crespire has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
nirvdrum has quit [Quit: nirvdrum]
crespire has quit [Killed (NickServ (GHOST command used by crespire1!crespire@user/crespire))]
crespire1 has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 272 seconds]
crespire has joined #ruby
crespire1 has quit [Ping timeout: 264 seconds]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 245 seconds]
desnudopenguino1 is now known as desnudopenguino
cek has quit [Quit: Connection closed for inactivity]
jenrzzz_ has joined #ruby
Guest17 has joined #ruby
Guest17 has quit [Ping timeout: 272 seconds]
jenrzzz_ has quit [Ping timeout: 260 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
Guest17 has joined #ruby
jenrzzz_ has joined #ruby
Guest17 has quit [Ping timeout: 256 seconds]
jenrzzz_ has quit [Ping timeout: 264 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 268 seconds]
Guest17 has joined #ruby
jas-maelstrom has quit [Remote host closed the connection]
Guest17 has quit [Ping timeout: 268 seconds]
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
Guest17 has joined #ruby
gaussianblue has joined #ruby
Guest17 has quit [Ping timeout: 260 seconds]
gaussianblue has quit [Quit: leaving]
grenierm has joined #ruby
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
jas-maelstrom has joined #ruby
gr33n7007h has quit [Ping timeout: 255 seconds]
Vonter has quit [Ping timeout: 255 seconds]
Vonter has joined #ruby
Guest17 has joined #ruby
Vonter has quit [Ping timeout: 264 seconds]
Vonter has joined #ruby
Guest17 has quit [Ping timeout: 252 seconds]
jenrzzz_ has joined #ruby
Guest17 has joined #ruby
Guest17 has quit [Ping timeout: 256 seconds]
rvalue has quit [Ping timeout: 252 seconds]
jenrzzz_ has quit [Ping timeout: 264 seconds]
rvalue has joined #ruby
Guest17 has joined #ruby
gr33n7007h has joined #ruby
Guest17 has quit [Ping timeout: 260 seconds]
Guest17 has joined #ruby
Guest17 has quit [Ping timeout: 268 seconds]
_ht has joined #ruby
Vonter has quit [Ping timeout: 264 seconds]
Guest17 has joined #ruby
Vonter has joined #ruby
Guest17 has quit [Ping timeout: 264 seconds]
gaussianblue has joined #ruby
Guest17 has joined #ruby
Guest17 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest17 has joined #ruby
gaussianblue has quit [Quit: leaving]
infinityfye has joined #ruby
Guest17 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
Guest17 has joined #ruby
pusewicz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
infinityfye has quit [Read error: Connection reset by peer]
infinityfye has joined #ruby
Guest17 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
grenierm has quit [Ping timeout: 250 seconds]
gaussianblue has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 240 seconds]
emilknievel has quit [Remote host closed the connection]
donofrio_ has joined #ruby
donofrio has quit [Ping timeout: 264 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 246 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
jenrzzz_ has joined #ruby
ht_ has joined #ruby
_ht has quit [Ping timeout: 252 seconds]
ht_ is now known as _ht
jenrzzz_ has quit [Ping timeout: 260 seconds]
osc4rpt has quit [Ping timeout: 256 seconds]
osc4rpt has joined #ruby
jenrzzz_ has joined #ruby
gaussianblue has quit [Quit: leaving]
jenrzzz_ has quit [Ping timeout: 268 seconds]
cek has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 252 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
brokkoli_origin has quit [Ping timeout: 264 seconds]
brokkoli_origin has joined #ruby
jenrzzz_ has joined #ruby
emilknievel has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
ua_ has quit [Remote host closed the connection]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
gr33n7007h has quit [Quit: WeeChat 4.2.1]
gr33n7007h has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
cek has quit [Quit: Connection closed for inactivity]
ua_ has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 268 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
Guest17 has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
Guest17 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Aminda has quit [Ping timeout: 260 seconds]
Aminda has joined #ruby
ht_ has joined #ruby
jenrzzz_ has joined #ruby
_ht has quit [Ping timeout: 252 seconds]
ht_ is now known as _ht
Perflosopher has quit [Ping timeout: 255 seconds]
jenrzzz_ has quit [Ping timeout: 268 seconds]
Perflosopher has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
pusewicz has joined #ruby
jenrzzz_ has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
jenrzzz_ has quit [Ping timeout: 255 seconds]
rvalue has quit [Ping timeout: 255 seconds]
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
rvalue has joined #ruby
gaussianblue has joined #ruby
jenrzzz_ has joined #ruby
felipec has joined #ruby
<felipec> Is it normal that this is so slow?
<felipec> actions = Array.new(256) { [0, 0] }
<felipec> 1_000_000.times { actions.each { |(type,index)| $x = type } }
jenrzzz_ has quit [Ping timeout: 268 seconds]
rvalue- has joined #ruby
Riviera has joined #ruby
Vonter has quit [Ping timeout: 264 seconds]
rvalue has quit [Ping timeout: 268 seconds]
Vonter has joined #ruby
rvalue- is now known as rvalue
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
jenrzzz_ has joined #ruby
gaussianblue has quit [Quit: leaving]
<[0x1eef]> felipec: Equivalent to 1_000_000 * 256. So yeah, I'd expect it to take a while.
jenrzzz_ has quit [Ping timeout: 240 seconds]
<felipec> [0x1eef]: takes 0.2 seconds in C
<felipec> 27 seconds in Ruby
jenrzzz_ has joined #ruby
<[0x1eef]> Ruby performance is nowhere near C performance.
<felipec> I know, but it's surprising a loop doing nothing takes a while.
<[0x1eef]> A loop that iterates 256 million times.
<havenwood> felipec: A JIT like TruffleRuby's will likely fold it away similar to an advanced compiler.
<havenwood> felipec: When using the reference implementation of Ruby, be sure to enable YJIT.
jenrzzz_ has quit [Ping timeout: 252 seconds]
<havenwood> Not doing much repeatedly can often be optimized, but microbenchmarks of this sort of often of dubious value.
<havenwood> /s/of/are/
<[0x1eef]> You can also consider dropping down to C when you hit performance bottlenecks. The Ruby C API is nice, and easy to use. It's usually a last resort though, especially for performance-type stuff.
jenrzzz_ has joined #ruby
<felipec> havenwood: OK, I tried with RUBY_YJIT_ENABLE=1, the loop test was reduced from 12s to 10s.
<felipec> But the real test was reduced from 27s to 13.
<felipec> Nice.
<felipec> [0x1eef]: that's precisely what I did: I wrote a simple linked list implementation in C and wrote Ruby bindings for it.
jenrzzz_ has quit [Ping timeout: 255 seconds]
<[0x1eef]> Sounds good.
<felipec> With YJIT enabled Ruby 3.3 takes as much time as Go.
<[0x1eef]> The given code appears to assign 0 to $x 256 million times so I'm not sure there's much there but I assume you are benchmarking something a bit more realisitic.
jenrzzz_ has joined #ruby
ua_ has quit [Ping timeout: 268 seconds]
jenrzzz_ has quit [Ping timeout: 255 seconds]
<felipec> [0x1eef]: yeah, every single one of those iterations is going to do something, for example type=1 is add a node, and type=2 is deleting a node.
ua_ has joined #ruby
jenrzzz_ has joined #ruby
<[0x1eef]> Roger
jenrzzz_ has quit [Ping timeout: 268 seconds]
victori has quit [Ping timeout: 268 seconds]
vigumnov has joined #ruby
Synthead has joined #ruby
<Synthead> How do I create an ascii 8-bit string as a frozen constant?
<Synthead> READ_HEADER = "\xc5".force_encoding(Encoding::ASCII_8BIT)
<Synthead> `force_encoding': can't modify frozen String: "\xC5" (FrozenError)
<Synthead> this is what I get when attempting to do it this way
<Synthead> I also tried [0xc5].pack("C"), but for some reason, this creates 197 instead of "\xC5"
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
jenrzzz_ has joined #ruby
___nick___ has quit [Ping timeout: 255 seconds]
desnudopenguino has quit [Ping timeout: 272 seconds]
jenrzzz_ has quit [Ping timeout: 272 seconds]
jenrzzz_ has joined #ruby
<Synthead> ah oops, it was me: [0xc5].pack("C") works just fine
Synthead has quit [Quit: Leaving]
desnudopenguino has joined #ruby
jenrzzz_ has quit [Ping timeout: 252 seconds]
_ht has quit [Remote host closed the connection]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 268 seconds]
cek has joined #ruby
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 260 seconds]
orbyt_v10 has joined #ruby
orbyt_v10 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brokkoli_origin has quit [Ping timeout: 252 seconds]
jenrzzz_ has joined #ruby
brokkoli_origin has joined #ruby
jenrzzz_ has quit [Ping timeout: 268 seconds]
rlima has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
jenrzzz_ has joined #ruby
rlima has quit [Quit: WeeChat 3.5]
donofrio__ has joined #ruby
jenrzzz_ has quit [Ping timeout: 272 seconds]
donofrio_ has quit [Ping timeout: 252 seconds]
jenrzzz_ has joined #ruby
jenrzzz_ has quit [Ping timeout: 264 seconds]
emilknievel has quit [Ping timeout: 260 seconds]