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/
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
szkl has joined #ruby
Dooky has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ox1eef_> havenwood: JRuby performs good when the VM is warm, but I think its boot time is overlooked when all things are considered.
<ox1eef_> Unless that's changed in recent times. It has been a long time since I was a jruby user.
caedmon has joined #ruby
roadie has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
roadie has quit [Ping timeout: 248 seconds]
crespire has joined #ruby
<havenwood> ox1eef_: I was guessing that at the point 1M i/s matter the boot time penalty is absorbed, but ¯\_(ツ)_/¯
<havenwood> Maybe it's few records really fast. I just assumed, but could be either way.
<havenwood> If so, a `--disable-all` probably matters more than split/scan.
<havenwood> RubyGems in particular takes a while to load.
<havenwood> A `--disable-gems` alone does most the work.
crespire1 has quit [Ping timeout: 265 seconds]
caedmon has quit [Quit: caedmon]
caedmon has joined #ruby
duderonomy has quit [Quit: Textual IRC Client: www.textualapp.com]
caedmon has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
ur5us has joined #ruby
moldorcoder7 has quit [Ping timeout: 268 seconds]
roadie has quit [Ping timeout: 248 seconds]
caedmon has joined #ruby
teclator has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
caedmon has joined #ruby
caedmon has quit [Ping timeout: 246 seconds]
desnudopenguino has quit [Quit: desnudopenguino]
desnudopenguino has joined #ruby
CrazyEddy has joined #ruby
caedmon has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
caedmon has joined #ruby
caedmon has quit [Client Quit]
caedmon has joined #ruby
teclator has quit [Ping timeout: 268 seconds]
Sankalp has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
caedmon has quit [Ping timeout: 265 seconds]
Sankalp has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 240 seconds]
desnudopenguino1 is now known as desnudopenguino
blackmetal has quit [Ping timeout: 240 seconds]
caedmon has joined #ruby
cherryramatisdev has joined #ruby
cherryramatisdev has quit [Client Quit]
cherryramatisdev has joined #ruby
cherryramatisdev has quit [Client Quit]
cherryramatisdev has joined #ruby
cherryramatisdev has quit [Client Quit]
cherryramatisdev has joined #ruby
cherryramatisdev has quit [Ping timeout: 240 seconds]
caedmon has quit [Ping timeout: 256 seconds]
_ht has joined #ruby
roadie has joined #ruby
repack25 has joined #ruby
repack25 has quit [K-Lined]
roadie has quit [Ping timeout: 248 seconds]
blackmetal has joined #ruby
sam113101 has quit [Read error: Connection reset by peer]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
ap4y has quit [Remote host closed the connection]
grenierm has joined #ruby
ur5us has quit [Ping timeout: 248 seconds]
sam113101 has joined #ruby
_ht has quit [Remote host closed the connection]
walez_ has joined #ruby
roadie has joined #ruby
<ox1eef_> It is especially good for long running processes, but for quick scripts the boot time stands out.
walez_ has quit [Quit: Leaving]
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
donofrio_ has joined #ruby
Al2O3 has joined #ruby
donofrio has quit [Ping timeout: 264 seconds]
gcd has quit [Ping timeout: 268 seconds]
gcd has joined #ruby
blackmetal has quit [Quit: Lost terminal]
johnjaye has quit [Ping timeout: 240 seconds]
johnjaye has joined #ruby
roadie has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.0.91)]
teclator has joined #ruby
adam12 has quit [Quit: Ping timeout (120 seconds)]
adam12 has joined #ruby
kapil has quit [Quit: ZNC 1.7.5+deb4 - https://znc.in]
kapil has joined #ruby
teclator has quit [Ping timeout: 268 seconds]
grenierm has quit [Quit: Client closed]
otisolsen70 has joined #ruby
teclator has joined #ruby
infinityfye has joined #ruby
crespire 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
TomyWork has joined #ruby
crespire has quit [Remote host closed the connection]
crespire has joined #ruby
BazzaBazaa has joined #ruby
gcd has quit [Ping timeout: 265 seconds]
gcd has joined #ruby
<isene> I am trying to avoid any external dependencies beyond pure Ruby (like writing an extension in Fortran or some such)
<isene> I have a working Ruby shell now with tab completions, syntax highlighting and more. Trying here to speed up the highlighting - this is the reason for the question
<isene> leah2: Is using scan with a block faster? If yes, why?
tjnhxmzhmqgytuwt has quit [Remote host closed the connection]
ur5us has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
Furai has quit [Quit: WeeChat 3.8]
Furai has joined #ruby
cek has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
shokohsc2 has joined #ruby
shokohsc has quit [Ping timeout: 240 seconds]
shokohsc2 is now known as shokohsc
<leah2> doesnt allocate an array?
<leah2> and only one string at a time
desnudopenguino1 has joined #ruby
desnudopenguino has quit [Ping timeout: 240 seconds]
desnudopenguino1 is now known as desnudopenguino
desnudopenguino has quit [Quit: desnudopenguino]
moldorcoder7 has joined #ruby
moldorcoder7 has quit [Ping timeout: 265 seconds]
<isene> leah2: Example code?
Dooky has joined #ruby
<leah2> "foo bar baz".scan(/\S+|\s+/) { p $& }
<leah2> you can use { |x| p x }
<ox1eef_> Check out strscan / StringScanner too
<leah2> same cost
<leah2> yeah
Terminus has joined #ruby
<Terminus> hello. if i already have something installed in /usr/local/bundle/bundler/gems/ using :git, is there a way to prevent `bundle lock` from attempting to fetch with git and just use what's already there?
donofrio has joined #ruby
<ox1eef_> --local, --prefer-local, and --deployment options to 'bundle install' may help.
cek has quit [Quit: Connection closed for inactivity]
<Terminus> ox1eef_: i've tried --local and it just says it's not yet checked out. no Gemfile.lock generated.
<Terminus> ox1eef_: oh i see what you mean! use it with `bundle install`. thanks!
dalan0382 has quit [Quit: dalan0382]
dalan0382 has joined #ruby
crespire1 has joined #ruby
crespire has quit [Killed (NickServ (GHOST command used by crespire1!~crespire@user/crespire))]
cherryramatis has joined #ruby
cherryramatis has quit [Client Quit]
cherryramatis has joined #ruby
<Terminus> --local didn't work but --prefer-local did it.
<Terminus> ox1eef_: whoops. i think i must have been a bit too excited. `bundle lock` still tries to use git even if the repo was previously installed with either `--local` or `--prefer-local`.
cherryramatis has quit [Quit: WeeChat 3.8]
<ox1eef_> Terminus: Have a read through the 'bundle install -h' man page.
cherryramatis has joined #ruby
<ox1eef_> It might be a limitation or oversight. The man page says do not contact rubygems.org but not neccessarily git.
<Terminus> ox1eef_: yeah, i see it. thanks. i think i'll leave this alone for now. not that important anyway considering i'm not generating a Gemfile.lock every second.
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
<ox1eef_> A nice feature of npm is git installs.
<ox1eef_> npm i git+foobar.com/foo/bar.git#v0.1.0
<ox1eef_> I wish Ruby had the same.
<Terminus> i'm just a casual ruby user so i'm not familiar with pitfalls.
<Terminus> but yeah, i get why somebody who writes ruby a lot would want that feature.
<leah2> bundler does that no
<BazzaBazaa> was going to say the same about bundler
sickdyd has quit [Ping timeout: 240 seconds]
<Terminus> oh wait, now that that's mentioned, that's exactly what i'm doing with `gem "foo", git: "http://foo.com/bar/baz", tag: "v1.0"`
<Terminus> i should sleep if i don't even really understand what people are saying anymore.
roadie has joined #ruby
<BazzaBazaa> I never understand what anyone says
otisolsen70 has quit [Quit: Leaving]
<ox1eef_> leah2: it has a degree of support, yeah - but I don't think as solid as NPM.
hightower3 has quit [Ping timeout: 264 seconds]
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 268 seconds]
<isene> leah2: Here's the code I want to optimize; https://gist.github.com/isene/18d069437671387bff63ba23b04acea6
<leah2> i guess performance is dominated by system and file.exists :p
<leah2> you could consider gsub
dza has quit [Quit: Ping timeout (120 seconds)]
dza has joined #ruby
<isene> leah2: I've seen gsub being slow, but I'll check
swaggboi has quit [Quit: C-x C-c]
<leah2> it doesnt need a call for the \s case tho
sickdyd has joined #ruby
<isene> leah2: If I don't match on \s, then double-spaces get lost on the join
<leah2> you dont need a join with gsub either
sickdyd has quit [Ping timeout: 240 seconds]
<isene> leah2: Simplified it (check gist url again)
<isene> I'm not sure how I would go about gsub'ing all this, though
<leah2> str.gsub(/\S+/) { |el| ... }
cherryramatis has quit [Quit: WeeChat 3.8]
cherryramatis has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
cherryramatis has quit [Ping timeout: 264 seconds]
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 256 seconds]
cherryramatis has joined #ruby
swaggboi has joined #ruby
cherryramatis has quit [Ping timeout: 240 seconds]
blackmetal has joined #ruby
<isene> leah2: Now that is indeed the fastest so far - check gist url
<isene> Thanks a plenty. Release of Ruby SHell (rsh) coming soon.
<leah2> next, make sure @nick and @gnick are Set or Hash
<leah2> and probably cache a list of binaries instead of calling which
<blackmetal> rsh?!
<blackmetal> daaaaaaaaaaaaaamn
<blackmetal> that would be neat as openbsd's new default shell
<blackmetal> (since im banking on openbsd.org soon running ruby)
<blackmetal> what great times we live in
gr33n7007h has quit [Ping timeout: 246 seconds]
moldorcoder7 has joined #ruby
_ht has joined #ruby
sickdyd has joined #ruby
cherryramatis has joined #ruby
Al2O3 has quit [Remote host closed the connection]
catphish has quit [Read error: Connection reset by peer]
catphish has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
cherryramatis has quit [Ping timeout: 240 seconds]
<isene> leah2: @nick and @gnick are hashes. I'm not sure about the caching of binaries, though as it may impact startup time and also the fact of having to rehash manually or having a timer do that
<havenwood> isene: It's much faster to check in Ruby if a command is in the PATH, FWIW. It's a bit faster to pipe from Ruby rather than >/dev/null as well.
<havenwood> system 'which ruby', %i[out err] => File::NULL
<havenwood> But an order of magnitude faster to not shell out, it looks like.
<havenwood> ENV.fetch('PATH').split(':').find { |dir| Dir["#{dir}/*"].find { |path| File.basename(path) == command } }
<havenwood> For the former example, I meant: system "which #{command}", %i[out err] => File::NULL
hightower2 has joined #ruby
Prodigy has joined #ruby
TomyWork has quit [Quit: Leaving]
TomyLobo has joined #ruby
cherryramatis has joined #ruby
<leah2> you can do it in a background thread on startup :p
sickdyd has joined #ruby
Prodigy has quit [Quit: \]
cherryramatis has quit [Ping timeout: 256 seconds]
donofrio has quit [Ping timeout: 240 seconds]
sickdyd has quit [Ping timeout: 240 seconds]
donofrio has joined #ruby
cherryramatis has joined #ruby
cherryramatis has quit [Ping timeout: 265 seconds]
caedmon has joined #ruby
sickdyd has joined #ruby
<isene> havenwood: Thanks. Will fix this.
sickdyd has quit [Ping timeout: 240 seconds]
<isene> rsh release; https://github.com/isene/rsh
<isene> havenwood: The shell-out is actually faster, it seems
mexen has joined #ruby
<isene> But with your tip on piping from Ruby makes the fastest solution yet. Cool.
cherryramatis has joined #ruby
desnudopenguino has joined #ruby
cherryramatis has quit [Ping timeout: 246 seconds]
<isene> leah2: Yeah, but if there is a change in the executables while a shell is in action, it wouldn't catch that. I want rsh to be fully trustworthy
cherryramatis has joined #ruby
gr33n7007h has joined #ruby
oboist55 has joined #ruby
srushe has quit [Remote host closed the connection]
g_sg has quit [Remote host closed the connection]
slondr has quit [Remote host closed the connection]
whereiseveryone has quit [Remote host closed the connection]
sgtapple has quit [Read error: Connection reset by peer]
caleb has quit [Remote host closed the connection]
matta has quit [Write error: Connection reset by peer]
alexisg has quit [Remote host closed the connection]
KOTP has quit [Remote host closed the connection]
Bounga has quit [Remote host closed the connection]
pjaspers has quit [Remote host closed the connection]
graemefawcett has quit [Remote host closed the connection]
tsujp has quit [Remote host closed the connection]
graemefawcett has joined #ruby
whereiseveryone has joined #ruby
caleb has joined #ruby
slondr has joined #ruby
matta has joined #ruby
pjaspers has joined #ruby
alexisg has joined #ruby
tsujp has joined #ruby
sgtapple has joined #ruby
Bounga has joined #ruby
hwrd_ has joined #ruby
g_sg has joined #ruby
sickdyd has joined #ruby
KOTP has joined #ruby
srushe has joined #ruby
sickdyd has quit [Ping timeout: 264 seconds]
hwrd_ has quit [Ping timeout: 250 seconds]
mexen has quit []
<johnjaye> ok. am i taking crazy pills or does ruby have unique semantics around recursion?
desnudopenguino1 has joined #ruby
<johnjaye> these two fragments should behave identically. but they do not. http://dpaste.com//8JFJTD24L
oboist55 has quit [Ping timeout: 240 seconds]
desnudopenguino has quit [Ping timeout: 256 seconds]
desnudopenguino1 is now known as desnudopenguino
<havenwood> johnjaye: you inverted the order in your if statement with the same condition in both.
<havenwood> They're not the same.
<johnjaye> ok. so i am taking crazy pills. that's a relief.
<havenwood> johnjaye: Did you mean to have `if n >= 2` in one of them maybe?
<johnjaye> i thought there was something wrong with ruby.
<havenwood> Or just keep the same order.
<havenwood> Nope, Ruby is fine in this case!
<johnjaye> i was a bit miffed i couldn't just do puts number+string though
<johnjaye> i guess it tries to coerce the string to a number
<havenwood> johnjaye: sounds like you wanted weakly typed there, but Ruby is strongly typed.
<johnjaye> what does that mean in context
<johnjaye> you can't have strong typing and convert the number to a string?
<havenwood> johnjaye: you can have a method that accepts many classes, but you can't just swap one class in for another implicitly. Ruby is like Python and most other modern dynamic languages in that regard, unlike PHP.
<havenwood> Unlike JavaScript.
<havenwood> For example, TypeScript is strongly typed and JavaScript is weakly typed.
<havenwood> johnjaye: A `puts` automatically appends a `"\n"` and takes anything that implements #to_s.
<havenwood> justache: Just: puts n
<havenwood> Or if you want things other than a newline, interoplate in a String literal like: puts "Number: #{n}"
<johnjaye> ah ok. is ruby the only langauge that does that
<johnjaye> i cant' recall if python or perl does
<ox1eef_> puts comes from C.
<ox1eef_> There's also print - that omits a newline unless explicitly given, same for printf.
<johnjaye> ok
<ox1eef_> Another useful string function is 'format'.
<ox1eef_> >> format("Hello %{n}", n: 'johnjaye')
<ruby[bot]> ox1eef_: # => "Hello johnjaye" (https://carc.in/#/r/f451)
<johnjaye> ah ok. does python have that
<johnjaye> i know lisp does.
<johnjaye> ruby has lots of good lispism
<johnjaye> or isms
<ox1eef_> I don't know much of anything about Python. But template strings or some variation of them I reckon are common.
<blackmetal> yo yo
<blackmetal> ox1eef_: managed to get anywhere with your AI stuff?
<blackmetal> havenwood: revertede to puma :((((( darn websockets
sickdyd has joined #ruby
caedmon has quit [Ping timeout: 240 seconds]
goldfish has joined #ruby
goldfish has quit [Read error: Connection reset by peer]
goldfish has joined #ruby
goldfish has quit [Remote host closed the connection]
<blackmetal> ox1eef_: could we initiate a similar AI learning? https://www.youtube.com/watch?v=Cms_v_OUXco
<blackmetal> how would that work?
sickdyd has quit [Ping timeout: 240 seconds]
<blackmetal> after getting rich from ruby im definitely gonna start building AI spacecraft
goldfish has joined #ruby
brw has quit [Quit: The Lounge - https://thelounge.chat]
<blackmetal> ox1eef_: wern't we gonna do all sorts of chat bots and AI video generators? u left me hanging had to do it all myself :/
Linux_Kerio has joined #ruby
brw has joined #ruby
<isene> Could anyone here offer advice on how to amend my code in rsh to accept pasting onto the command line. Issue is of course that I wrote the readline parser from scratch and it parses character-by-character, effectively killing any pasting of many characters at a time. Tried to fix it, but remains a tad stuck here...
blackmetal has quit [Quit: Lost terminal]
<weaksauc_> buffer it?
_ht has quit [Remote host closed the connection]
<ox1eef_> Check what IRB / Pry do to handle that.
<weaksauc_> even they don't really handle it all that well
<ox1eef_> Pry handles it poorly because it interpets a string prefixed with a dot as a system command, so copy & paste will run Ruby code on your shell.
<ox1eef_> If you remove that feature, it usually works for me.
<ox1eef_> Another thing I remember is that Pry has an input array, and every line of input is kept there afaik.
<weaksauc_> isene what's the goal here? to be a ruby shell ala pry or to be a shell written in ruby ala something closer to zsh?
Cork has quit [Ping timeout: 240 seconds]
reset has joined #ruby
cherryramatis has quit [Read error: Connection reset by peer]
cherryramatis has joined #ruby
<johnjaye> why does pry exist? what does it do differently to irb
cherryramatis has quit [Read error: Connection reset by peer]
weyhmueller has quit [Quit: ZNC - https://znc.in]
cherryramatis has joined #ruby
weyhmueller has joined #ruby
goldfish has quit [Remote host closed the connection]
goldfish has joined #ruby
<llua> someone wanted to make it
cherryramatis has quit [Read error: Connection reset by peer]
sickdyd has joined #ruby
cherryramatis has joined #ruby
<havenwood> johnjaye: Pry was created back when IRB lacked comparable features. IRB copied Pry features to become a viable alternative.
<weaksauc_> isn't there pry debugging? does irb have that?
tomtmym has quit [Quit: Gone.]
<havenwood> weaksauc_: Debug now ships with Ruby, so you can `binding.irb` and type `debug` to enter rdbg.
<weaksauc_> ah nice
sickdyd has quit [Ping timeout: 240 seconds]
<isene> weaksauc_: I want to replace my zsh. Having tweaked zsh for more than 20 years, it's become quite complex with lots of antibody extensions etc. The dependencies are itchy. I want a shell that is one single executable file with no dependencies. That makes for easier setup or migration to new machines. And with Ruby right there on the command line.
<havenwood> weaksauc_: Pry doesn't ship with a debugger, but byebug is popular.
<isene> So how would I buffer the STDIN?
<havenwood> You might take a look at Xiki from a little over a decade ago for inspiration if you're making a Ruby shell.
<havenwood> The project faded or pivoted from what I recall, but interesting concepts and a Ruby implementation.
<weaksauc_> rate limit the input perhaps?
infinityfye has quit [Quit: Leaving]
<weaksauc_> and then switch to a different method of parsing
<weaksauc_> have it be some kind of input that would not be feasible for a person to type before the switch
<isene> I'd look for a simple change to the code I already have if possible
<havenwood> isene: What's the current code?
<weaksauc_> is your code anywhere?
<havenwood> isene: Primordial Pry is: loop { eval $stdin.readline }
cherryramatis has quit [Read error: Connection reset by peer]
cherryramatis has joined #ruby
<weaksauc_> isene pretty neat project
<rapha> oh cool
<isene> I tried readline. And tty-prompt etc. But for the syntax highlighting, I needed full control of the input and opted to write the readline parser from scratch, with code taken from my rtfm-filemanager project. But unlike rtfm, I now need to accept pastes...
cherryramatis has quit [Ping timeout: 248 seconds]
cherryramatis has joined #ruby
teclator has quit [Ping timeout: 248 seconds]
Cork has joined #ruby
Cork has quit [Ping timeout: 240 seconds]
donofrio_ has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
donofrio_ has joined #ruby
donofrio_ has quit [Remote host closed the connection]
roadie has quit [Remote host closed the connection]
cherryramatis has quit [Read error: Connection reset by peer]
cherryramatis has joined #ruby
ur5us has joined #ruby
goldfish has quit [Remote host closed the connection]
goldfish has joined #ruby
goldfish has quit [Remote host closed the connection]
roadie has joined #ruby
donofrio has quit [Ping timeout: 268 seconds]
Guest82 has joined #ruby
Guest82 has quit [Client Quit]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
shokohsc0 has joined #ruby
shokohsc has quit [Ping timeout: 240 seconds]
shokohsc0 is now known as shokohsc
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
<isene> How do I check the length of the content of STDIN?
sickdyd has joined #ruby
szkl has quit [Quit: Connection closed for inactivity]
goldfish has joined #ruby
goldfish has quit [Remote host closed the connection]
goldfish has joined #ruby
goldfish has quit [Remote host closed the connection]
ap4y has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
c10l has joined #ruby
Al2O3 has joined #ruby
sickdyd has joined #ruby
znpy has quit [Ping timeout: 256 seconds]
gr33n7007h has quit [Ping timeout: 240 seconds]
gr33n7007h has joined #ruby
znpy has joined #ruby
gr33n7007h has quit [Ping timeout: 248 seconds]
gr33n7007h has joined #ruby
Linux_Kerio has quit [Ping timeout: 240 seconds]