havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.2, 3.1.4, 3.0.6, 3.3.0-preview1: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://t.ly/9ua4 | Logs: https://libera.irclog.whitequark.org/ruby/
Guest70 has joined #ruby
Guest70 has quit [Quit: Client closed]
roadie has quit [Ping timeout: 248 seconds]
cek has quit [Quit: Connection closed for inactivity]
tweaks has quit [Quit: tweaks]
tweaks has joined #ruby
roadie has joined #ruby
donofrio has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 248 seconds]
Cache_Money has quit [Ping timeout: 245 seconds]
ikonia has quit [Ping timeout: 246 seconds]
roadie has joined #ruby
caedmon has joined #ruby
caedmon has quit [Client Quit]
roadie has quit [Ping timeout: 248 seconds]
moldorcoder7 has quit [Ping timeout: 248 seconds]
jhass has quit [Ping timeout: 246 seconds]
jhass has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
Sankalp has quit [Ping timeout: 240 seconds]
Sankalp has joined #ruby
goldfish has quit [Remote host closed the connection]
roadie has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
ap4y has quit [Remote host closed the connection]
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
_ht has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
brw has joined #ruby
jhass has quit [Ping timeout: 256 seconds]
jhass has joined #ruby
JSharp has quit [Ping timeout: 250 seconds]
JSharp has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
_ht has quit [Quit: _ht]
swaggboi has quit [Ping timeout: 248 seconds]
swaggboi has joined #ruby
Onos60 has joined #ruby
teclator has joined #ruby
Onos60 has quit [Ping timeout: 268 seconds]
lena64t has quit [Remote host closed the connection]
lena64t has joined #ruby
lena64t has quit [Remote host closed the connection]
lena64t has joined #ruby
rvalue has quit [Ping timeout: 240 seconds]
lena64t has quit [Remote host closed the connection]
rvalue has joined #ruby
infinityfye has joined #ruby
sickdyd has quit [Quit: WeeChat 3.8]
moldorcoder7 has joined #ruby
Purims79 has joined #ruby
crespire1 has quit [Ping timeout: 240 seconds]
crespire has joined #ruby
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
BazzaBazaa has joined #ruby
Purims79 has quit [Ping timeout: 246 seconds]
BazzaBazaa has quit [Ping timeout: 245 seconds]
BazzaBazaa has joined #ruby
moldorcoder7_ has joined #ruby
moldorcoder7 has quit [Ping timeout: 240 seconds]
<BazzaBazaa> hi all, trying to update an old app. rspec ests currently do: `page.should have_selector(:xpath, '//foo/bar', visible: false)
<BazzaBazaa> any suggestions on updating this style to expect style?
johnjaye has quit [Ping timeout: 240 seconds]
shokohsc3 has joined #ruby
shokohsc has quit [Ping timeout: 268 seconds]
shokohsc3 is now known as shokohsc
<BazzaBazaa> for example: `expect(page).to ... '//foo/bar' ...
panella32 has joined #ruby
panella32 has quit [Quit: Textual IRC Client: www.textualapp.com]
TomyWork has joined #ruby
hightower2 has quit [Ping timeout: 240 seconds]
hightower2 has joined #ruby
hightower2 has quit [Ping timeout: 268 seconds]
BazzaBazaa has quit [Remote host closed the connection]
<aesthetikx> BazzaBazaa I think its really the same, e.g. expect(page).to have_selector(:xpath, '//foo/bar, visible: false)
<aesthetikx> there may be a more eloquent way of expressing your specific example, depending on the use case, e.g.
<aesthetikx> expect(page).not_to have_content('Some Text')
<aesthetikx> or,
<aesthetikx> expdct(page).not_to have_css('.some.css')
<aesthetikx> but have_selector is still valid and used i believe
moldorcoder7_ has quit [Ping timeout: 240 seconds]
dalan03821 has joined #ruby
dalan0382 has quit [Ping timeout: 256 seconds]
dalan03821 is now known as dalan0382
BazzaBazaa has joined #ruby
hightower2 has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
caedmon has joined #ruby
hightower2 has quit [Read error: Connection reset by peer]
aesthetikx has quit [Ping timeout: 260 seconds]
aesthetikx has joined #ruby
johnjaye has joined #ruby
TomyWork has quit [Remote host closed the connection]
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
<dorian> hey can anybody point me to a type assertion/coercion/data structure validation library *other* than dry-rb?
<dorian> this is the third time i have tried to use dry-rb and every time i find some totally ordinary use case it doesn't do
<dorian> preferably something that's more like Type::Tiny for perl
caedmon has quit [Quit: caedmon]
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
gr33n7007h has quit [Quit: WeeChat 3.8]
gr33n7007h has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
<hexology> is anyone interested in providing some code review on my first ruby program? https://git.sr.ht/~wintershadows/polyglot-benchmarks/tree/master/item/running-stats-cli/implementations/ruby/calc_loop_optim.rb this is a port of a python script https://git.sr.ht/~wintershadows/polyglot-benchmarks/tree/master/item/running-stats-cli/implementations/python/calc_loop_optim.py and it's intended to be a sort of language runtime benchmark. open to suggestions about
<hexology> performance improvements as well, on 30 million rows cpython is finishing in ~4 seconds and ruby 3.2 with yjit enabled is finishing in ~6 seconds
<hexology> i assume this `def main` isn't entirely idiomatic, but i wasn't sure
<hexology> i suspect that cpython cheats and just uses a much larger stdin buffer than the other runtimes it surprisingly beats (e.g luajit, common lisp), but i'm not sure how i'd check that. is there a way to see the size of the stdin buffer in ruby?
_ht has joined #ruby
reset has joined #ruby
moldorcoder7 has joined #ruby
libsys has joined #ruby
goldfish has joined #ruby
cek has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
<libsys> where does the guy from socketry hang out? I'd like to ask him about the usage of rubydns or async-dns
<libsys> specifically, if I should use rubydns or async-dns for new projects heh
aesthetikx has quit [Ping timeout: 240 seconds]
rvalue has joined #ruby
___nick___ has joined #ruby
aesthetikx has joined #ruby
leftylink has quit [Quit: leaving]
leftylink has joined #ruby
Sankalp has quit [Ping timeout: 268 seconds]
Sankalp has joined #ruby
cek has quit [Quit: Connection closed for inactivity]
___nick___ has quit [Ping timeout: 240 seconds]
SunClonus has joined #ruby
_ht has quit [Quit: _ht]
SunClonus has quit [Read error: Connection reset by peer]
goldfish has quit [Quit: Leaving]
lena64t has joined #ruby
tomtmym has quit [Quit: Gone.]
Sankalp has quit [Ping timeout: 240 seconds]
gr33n7007h has quit [Ping timeout: 248 seconds]
teclator has quit [Ping timeout: 268 seconds]
Sankalp has joined #ruby
gr33n7007h has joined #ruby
<mooff> hexology: that's a pretty straight translation of the Python into Ruby
<mooff> surprising that cpython beats luajit..
roadie has quit [Ping timeout: 248 seconds]
<mooff> can i see the lua?! lol
<hexology> mooff: unabashedly so :) i did however benefit from rubocop's suggestions in removing the extraneous being/end inside the do blocks.
<hexology> i think i might have lost track of the lua version i had a while ago. the logic was basically the same but i don't know if i was reading from stdin correctly
<mooff> the equivalent of if __name__ == "__main__" in Ruby is if __FILE__ == $0
<hexology> thanks. is that idiomatic or is it just me transliterating python to ruby syntax?
<mooff> what do you mean by "that"?
<hexology> putting "if __FILE__ == $0 \n main \n end" in a script
ur5us has joined #ruby
<ox1eef_> It is the normal way to detect if the script being executed is the same script given to Ruby at the command line. But not once did I ever need that.
<mooff> it's not terribly common to see such a main method defined, but it seems fine
<Momentum> hi folks
<ox1eef_> I often define name for CLI tools.
<ox1eef_> s/name/main/
<ox1eef_> o/ Momentum
<hexology> thanks all
<Momentum> hi ox1eef_ good to see you
roadie has joined #ruby
<ox1eef_> You too :)
<Momentum> the ruby package on arch has been stuck on 3.0.5 for a while
<hexology> it's usually not needed in python, but it's become idiomatic "just in case" you also want to import things from your module in other code, e.g. for calling functions in a test suite
<mooff> hexology: how many lines does it process during the benchmark?
<Momentum> should i use RVM? or there's a better way?
<ox1eef_> That's unusual for Arch.
<Momentum> yeah
<Momentum> they seem to be aware of it though
FetidToot5 has joined #ruby
<weaksauc_> rbenv i like more Momentum
<mooff> surprised you don't get updates from every commit to Ruby trunk on Arch :P
<weaksauc_> if not that then i'd probably invest time in asdf
m_antis_ has joined #ruby
<ox1eef_> chruby / ruby-install is what I'd generally recommend. Personally I compile from scratch.
<Momentum> nice mix of options
NightMonkey_ has joined #ruby
<weaksauc_> technically ruby-install compiles from scratch doesn't it?
<Momentum> how long does the compiling from source take i wonder?
<ox1eef_> I think so. But not sure.
<ox1eef_> 15 minutes maximum.
<weaksauc_> not very long Momentum
<Momentum> manageable
<weaksauc_> i think last time it was like 10 min
<hexology> i installed 3.2.2 with rbenv the other day and it only took a few minutes, but i'm on a powerful machine
<weaksauc_> but i didn't time it and forgot about that tab for a while
<ox1eef_> ./configure --prefix=$HOME/.rubies/3.2.2; make; make install - then add $HOME/.rubies/3.2.2/bin to $PATH
<hexology> mooff: 30m lines, of which ~900k are blank (matching ^\s*$)
<ox1eef_> You definitely don't need tooling for it but it can be nice and easier to manage
<Momentum> thanks ox1eef_ i will try that
<Momentum> i should create the directory, right?
roadie has quit [Ping timeout: 248 seconds]
<Momentum> ~/.rubies that is
<ox1eef_> Check out --program-suffix too. If you have multiple versions, and don't want to rely on shell shims, it can be helpful. And yeah, can't hurt to do that.
<mooff> hexology: interesting. want to try a modification?
<mooff> rather than $stdin.each_line do |line| ..
<ox1eef_> You could also use chruby alone with that setup, where you're compiling rubies in ~/.rubies/X.X.X
<hexology> mooff: yes please!
<mooff> try: while line = $stdin.readline
<mooff> that's LESS idiomatic, but may run faster
Demi_ has joined #ruby
<hexology> mooff: interesting, why would it be faster? also, would i need to add an explicit `begin` inside the loop, right?
<Momentum> alright ox1eef_
<mooff> hexology: yes, i believe it would need an explicit "begin", then
<Momentum> not familiar with chruby so i will have to check that
admin2 has joined #ruby
<ox1eef_> It is focused on switching ruby versions in your shell environment, and does not do more than that (eg installing rubies).
roadie has joined #ruby
<weaksauc_> Momentum chruby is fine but it can run into some issues with some tooling
ur5us has quit [*.net *.split]
tweaks has quit [*.net *.split]
m_antis has quit [*.net *.split]
dostoyevsky2 has quit [*.net *.split]
FetidToot has quit [*.net *.split]
cybniv has quit [*.net *.split]
heartburn has quit [*.net *.split]
CalimeroTeknik has quit [*.net *.split]
NightMonkey has quit [*.net *.split]
pavelz has quit [*.net *.split]
Demi has quit [*.net *.split]
Vonter has quit [*.net *.split]
bastelfreak has quit [*.net *.split]
roger_rabbit has quit [*.net *.split]
Fridtjof has quit [*.net *.split]
FetidToot5 is now known as FetidToot
<weaksauc_> i find that the shim approach works better with tools like vscode
NightMonkey_ is now known as NightMonkey
infinityfye has quit [Quit: Leaving]
<Momentum> i see
<mooff> hexology: method / block calls are relatively slow in Ruby
<ox1eef_> Of all those tools, I believe postmodern got it right. One tool, one responibility.
<weaksauc_> technically ruby-install is separate from rbenv
<mooff> although #each (which calls a block for each item) is by far the most common way to iterate in Ruby, with high iteration counts, the block calls themselves add up
<weaksauc_> while doesn't create a new scope
<Momentum> i actually used rbenv before, seemed like a pretty solid tool i almost thought it was something official
<ox1eef_> The evolution was: RVM -> rbenv -> chruby. And I think chruby learnt from the mistakes of the past.
<Momentum> sounds good
shokohsc0 has joined #ruby
<Momentum> okay ruby-install along with chruby seems pretty good for me
shokohsc has quit [Ping timeout: 246 seconds]
shokohsc0 is now known as shokohsc
<Momentum> this is also better than relying on arch packages even though i wasn't planning to install multiple versions
<mooff> hexology: pardon me, you want $stdin.gets rather than $stdin.readline
<hexology> thanks
<ox1eef_> I rely on my system's package manager and a custom port (at least on FreeBSD where their default ruby installation is butchered).
<mooff> ($stdin.readline is the same as $stdin.gets, except it raises EOFError on eof)
<mooff> tested here and the change described works
<hexology> ox1eef_: i've been using rbenv because i'm very familiar with pyenv, which is apparently based on rbenv. what does chruby improve on?
<hexology> the asdf version manager has also become popular, but that's largely because it's able to handle *any* program with a plugin system. from what i remember, it works very similar to pyenv/rbenv
<hexology> mooff: good to know. i assume exception handling also has some additional overhead?
<ox1eef_> I prefer chruby's interface, and its ability to co-operate with other tools - which comes from doing one thing well.
<mooff> hexology: i think it does, but i haven't measured it
<hexology> ox1eef_: thanks. i'll look into it, happy to learn from other people's good ideas
<ox1eef_> Time is precious !
<mooff> you might even get a better treatment from the JIT if you can avoid exceptions
<mooff> something like "x = line.to_f", then "if x == 0.0; # check for blank/invalid line" might be optimal
<weaksauc_> that doesn't really give you the ability to use 0.0 in your data though
<weaksauc_> which would skew it
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
<mooff> yeah, you'd need to let valid 0.0's through
<mooff> sort of micro-optimising for the benchmark
<mooff> maybe not fair even if you got a boost
<mooff> ooh.. Float() takes exception: false
<weaksauc_> ah nice you can then check for nil
tweaks has joined #ruby
ur5us has joined #ruby
dostoyevsky2 has joined #ruby
cybniv has joined #ruby
CalimeroTeknik has joined #ruby
heartburn has joined #ruby
Vonter has joined #ruby
Fridtjof has joined #ruby
pavelz has joined #ruby
bastelfreak has joined #ruby
heartburn has quit [Max SendQ exceeded]
cybniv has quit [Max SendQ exceeded]
niv has joined #ruby
heartburn has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
<mooff> try this https://dpaste.org/RbfhT
<weaksauc_> you can get it faster still if you compile the regex and use match?
<mooff> :D
<mooff> = 0.0 and "btw zero is truthy"
<ruby-eval> => "btw zero is truthy"
<mooff> only nil and false are falsey, period
<Momentum> who's got period?
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
<hexology> mooff weaksauc_ thanks for these!
ap4y has joined #ruby
<mooff> hexology: curious for the new measurement
<weaksauc_> you're welcome
<mooff> ^^
<Momentum> > bad interpreter: No such file or directory
<Momentum> when i run anything other than ~/.rubies/3.2.2/ruby
<Momentum> like gem
<Momentum> did i mess up somewhere?
<weaksauc_> probably
<weaksauc_> which way did you go?
<Momentum> i used ruby-install then i just put the PATH in bash_profile
<weaksauc_> `which ruby`
<mooff> a shebang is pointing to something that doesn't exist
<Momentum> >/home/k2/.rubies/3.2.2/bin/ruby
<weaksauc_> that too use #! /usr/bin/env ruby generally
<mooff> `which gem`
<Momentum> >/home/k2/.rubies/3.2.2/bin/gem
<mooff> `head -n1 $(which gem)`
<Momentum> >#!/home/k2/.rubies/ruby-3.2.2/bin/ruby
<mooff> but `gem -v` doesn't work?
<Momentum> yeah
<Momentum> >bash: /home/k2/.rubies/3.2.2/bin/gem: /home/k2/.rubies/ruby-3.2.2/bin/ruby: bad interpreter: No such file or directory
<mooff> o.O
<Momentum> OH
<Momentum> i see
<Momentum> that's dumb
<Momentum> i change the name of the directory
<Momentum> it's supposed to be ruby-3.2.2
<Momentum> lol
<Momentum> i shouldn't have done that
<Momentum> changed*
<mooff> sanity restored :D
<Momentum> true
<Momentum> more like mine lost by changing the directory name after it was set as a prefix probably or whatever
<Momentum> time to go to sleep
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
<libsys> havenwood: thanks a lot
gr33n7007h has quit [Ping timeout: 256 seconds]
gr33n7007h has joined #ruby
gr33n7007h has quit [Ping timeout: 240 seconds]
sickdyd has joined #ruby
roadie has joined #ruby
gr33n7007h has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
CalculusCats is now known as CalculusCat
cognemo has quit [Ping timeout: 268 seconds]
cognemo has joined #ruby
<isene> What are the general recommendations for speeding up Ruby?