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/
<weaksauc_> measure before you try
<weaksauc_> find out where the bottlenecks are
<weaksauc_> figure out if there's something written in c that you can lean on
roadie has joined #ruby
<leftylink> yeah I'm gonna go with 1. profile and benchmark 2. improvements in asymptotic runtime will generally prevail over micro-optimisations 3. consider more compact data
<leftylink> I'm a little sad to say 3 because it usually makes things harder to understand
<leftylink> there are a lot of times where I'm dealing with something in 2d space
<mretka> Use the Benchmark module to measure performance https://github.com/ruby/benchmark
<leftylink> and 2-element arrays just make me sad every time
<leftylink> packing the two coordinates into one int wins pretty much every time. makes me pretty sad :<
<mretka> isene, which operation in Ruby would you like to speed up?
roadie has quit [Ping timeout: 248 seconds]
CalculusCat is now known as Calculuscats
Calculuscats is now known as CalculusCats
lena64t has quit [Quit: WeeChat 4.0.0-dev]
roadie has joined #ruby
ap4y has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
moldorcoder7 has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
szkl has joined #ruby
roadie has joined #ruby
ua_ has quit [Ping timeout: 240 seconds]
roadie has quit [Ping timeout: 248 seconds]
ua_ has joined #ruby
crespire has quit [Remote host closed the connection]
roadie has joined #ruby
sickdyd has quit [Quit: WeeChat 3.8]
Linux_Kerio has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
Linux_Kerio has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
defens has joined #ruby
defens has quit [Quit: Best CPUs can count to infinity twice without being bugged out by zero division errors or whatnot.]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
_ht has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
Linux_Kerio has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
_ht has quit [Quit: _ht]
cognemo has quit [Ping timeout: 240 seconds]
cognemo has joined #ruby
roadie has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
teclator has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
<isene> mretka: None in particular. Just looking for best practice tips in case I've missed something.
BazzaBazaa has joined #ruby
TomyWork has joined #ruby
shokohsc9 has joined #ruby
fat_shinobi has joined #ruby
shokohsc has quit [Ping timeout: 256 seconds]
shokohsc9 is now known as shokohsc
discou45 has joined #ruby
<ox1eef_> isene: There is the rubocop-performance gem. It can apply patterns that are usually faster than the alternatives. But don't solve a problem that doesn't exist, too.
micah has quit [Ping timeout: 268 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
otisolsen70 has joined #ruby
infinityfye has joined #ruby
<isene> ox1eef_: I'll check that gem. Just looking to learn here.
reset has quit [Quit: reset]
Linux_Kerio has quit [Read error: Connection reset by peer]
micah has joined #ruby
sickdyd has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
BazzaBazaa has joined #ruby
discou45 has quit [Ping timeout: 240 seconds]
BazzaBazaa has quit [Ping timeout: 245 seconds]
roadie has quit [Quit: ERC 5.5.0.29.1 (IRC client for GNU Emacs 29.0.91)]
<mooff> reducing method calls in hot paths is key for games on mruby
<mooff> using instance variables instead of accessors, asking an object to work on itself via instance vars rather than manipulating them via accessors externally, etc
<mooff> that's the juiciest optimisation as far as pure Ruby goes I think
<mooff> block calls are identical in cost to method calls, at least on mruby
<mooff> leading to e.g. being able to process physics for 10x more objects per frame if you can switch to a while loop, then send a single method call to each object to update itself
fetter has joined #ruby
brays has joined #ruby
fetter has quit [Ping timeout: 240 seconds]
Dooky has joined #ruby
anchor72 has joined #ruby
brays has quit [Ping timeout: 268 seconds]
<isene> rsh (https://github.com/isene/rsh) is coming along. Would be cool if some here could test and give feedback :-)
infinityfye has quit [Read error: Connection reset by peer]
infinityfye has joined #ruby
infinityfye has quit [Remote host closed the connection]
micah has quit [Changing host]
micah has joined #ruby
anchor72 has quit [Ping timeout: 268 seconds]
<gr33n7007h> isene: use File.exist? File.exists? was deprecated in 2.7 and removed in 3+
<mooff> nice!
<gr33n7007h> isene: line 390
<gr33n7007h> it looks like you've use exist? every else barring that line =)
crespire has joined #ruby
<mooff> give line 41 a method name so it's self explanatory
<mooff> put the statement that loads .rshrc on its own line
<mooff> the characters for the when statements on line 158-170 don't render on GitHub (appears like: when "", "")
<mooff> very nice work
infinityfye has joined #ruby
CrazyEddy has quit [Ping timeout: 256 seconds]
<gr33n7007h> methods from line 38-95 are available already if you require 'io/console' e.g your pos method can be: STDOUT.cursor STDOUT.cursor_up/down/left/right/clear_screen/goto/goto_column etc.
<gr33n7007h> *STDIN.cursor
victori has quit [Ping timeout: 240 seconds]
<gr33n7007h> isene: kudos +1 👍
CrazyEddy has joined #ruby
patrick has joined #ruby
Al2O3 has quit [Ping timeout: 240 seconds]
victori has joined #ruby
Al2O3 has joined #ruby
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
roadie has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
johnjaye has quit [Ping timeout: 256 seconds]
johnjaye has joined #ruby
<mooff> https://github.com/isene/rtfm is interesting too
Linux_Kerio has joined #ruby
TomyWork has quit [Remote host closed the connection]
polishdub has quit [Ping timeout: 268 seconds]
polishdub has joined #ruby
sickdyd has joined #ruby
polishdub has quit [Remote host closed the connection]
polishdub has joined #ruby
sickdyd has quit [Ping timeout: 268 seconds]
blackmetal has joined #ruby
szkl has quit [Quit: Connection closed for inactivity]
<blackmetal> anybody running askgpt in their consoles or similar?
_ht has joined #ruby
<aesthetikx> I made my own, https://github.com/aesthetikx/openai_pipe
gr33n7007h has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby
sickdyd has joined #ruby
<blackmetal> wow lo
<blackmetal> * lol
<blackmetal> whats special about it if i may ask?
<aesthetikx> not much special although it existed before askgpt; I just felt like making it
<blackmetal> it can write to files right? and read and analyze git repos?
<aesthetikx> not sure if you can pipe stuff in and out of askgpt
<blackmetal> ah i see
<aesthetikx> sortof
<blackmetal> i can't?
<blackmetal> then i guess ill drop my plansfor this evening
<aesthetikx> I mean you can pipe any file into it and it will be used as context, although it doens't really like do any git repo searching etc
<aesthetikx> mine is really simple,
<aesthetikx> it literally just takes what you pipe in, adds any extra strings, sends that to gpt3, and then prints the output
<aesthetikx> it doesn't have memory either, its not like using a chatgpt conversation
<blackmetal> nice
<aesthetikx> there are some ruby libraries that connect to openai that you might be able to use, what were you trying to do
<mooff> nice. check out ARGF, btw
sickdyd has quit [Ping timeout: 240 seconds]
<blackmetal> hmmm
<blackmetal> it just would be so cool to like
<blackmetal> "Complete all my tests"
<mooff> Write a test suite for this Ruby program
<blackmetal> "DRY everything inside the `app/` folder" etc.
<mooff> Refactor this to use $other_web_framework
<blackmetal> heheh
<blackmetal> or ask it to translate all python code in thee world to ruby
<aesthetikx> mooff I think I couldn't use ARGF in this case because I needed to differentiate between stidn, arg, or both at the same time
<aesthetikx> but I could be mistaken
m_antis_ has quit [Ping timeout: 268 seconds]
Assads has joined #ruby
teclator has quit [Ping timeout: 240 seconds]
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 240 seconds]
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
Assads has quit [Ping timeout: 240 seconds]
<mooff> ah yeah, you're expecting instructions from ARGV, then payload from stdin
sickdyd has joined #ruby
sickdyd has quit [Ping timeout: 256 seconds]
Pixi has quit [Ping timeout: 268 seconds]
reset has joined #ruby
Linux_Kerio has quit [Read error: Connection reset by peer]
Linux_Kerio has joined #ruby
Pixi has joined #ruby
shokohsc0 has joined #ruby
shokohsc has quit [Ping timeout: 250 seconds]
shokohsc0 is now known as shokohsc
sickdyd has joined #ruby
Sankalp has quit [Ping timeout: 256 seconds]
Sankalp has joined #ruby
otisolsen70 has quit [Quit: Leaving]
_ht has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
<isene> Thanks guys. Great feedback. Now for the specifics;
<isene> mooff: I don't know what to do about the rendering of lines 158-170 (when statements) as they are indeed control chars. Not that important though, as it's only the github rendering.
<isene> mooff: Line 41; Method statement? How so?
<mooff> isene: it prints a control sequence that you could give a name to using a method
<mooff> like the rest :-)
<isene> gr33n7007h: The cursor movement in io/console escaped me - the docs here is lacking plenty; https://ruby-doc.org/stdlib-2.5.0/libdoc/io/console/rdoc/IO.html
<isene> mooff: ah, yes
infinityfye has quit [Quit: Leaving]
<ox1eef_> io/console not being well documented could be because it was written by a Japanese person. And most of it is done in C.
<isene> After testing it, I'll think I'll stick with my own Cursor module as it's cleaner. io/console lacks several of the ANSI control sequences I need, and the it seems weird to do "STDIN.cursor_up", etc.
tomtmym has quit [Quit: Gone.]
blackmetal has quit [Quit: Lost terminal]
<isene> Released version 0.6 based on your feedback and with history search (via Shift-TAB) (https://github.com/isene/rsh)
<isene> This is the funnest thingie so far (RTFM held the previous personal fun record)
fat_shinobi has quit [Quit: Leaving]
Linux_Kerio has quit [Ping timeout: 240 seconds]
gonix has joined #ruby
<mooff> next tip: support Ctrl-P :)
<weaksauc_> ox1eef_ no it's because that site is using an ancient version of rdoc
<weaksauc_> probably
<weaksauc_> This page was generated for Ruby 2.5.0
<weaksauc_> Generated with Ruby-doc Rdoc Generator 0.42.0.
<weaksauc_> Ruby-doc.org is provided by James Britt and Neurogami. Maximum R+D.
<weaksauc_> rdoc is on to v 6.x now
<weaksauc_> isene are you still on ruby 2.5?