<FromGitter>
<girng> nice, now github homepage shows my issues
<FromGitter>
<girng> i don't like this
<FromGitter>
<girng> how i switch back
<FromGitter>
<girng> ok im trying to figure out why my code is acting like a bottleneck when over 50 games are run. which is 750 iterations per second, and there all sending `socket.write_bytes`, `socket.send`. the fibers just stop working. ⏎ here is the code: https://paste.ee/p/ERClR please look at the bottom at players.each part and read my commentary there
<FromGitter>
<girng> when i check top though, the CPU usage is 0.3%, memory usage is 0.xx% as well. very low, doesn't make sense, what's going on?
<FromGitter>
<bew> I/O operations doesn't use memory or cpu, so it makes sense to me i think
<FromGitter>
<girng> @bew yah, sdogruyol he thought it was I/O issues as well. but what does that mean exactly? is my network link just not fast enough for the throughput? i mean it's a local server so i should be fine, is there a way to monitor this stuff?
<FromGitter>
<bew> iotop ? ^^ or htop can do it too iirc
<FromGitter>
<girng> i tried to run iotop on WSL, but I get an error. let me try htop
<FromGitter>
<girng> ok `htop` works. when i run my gmaeserrver and load up the game. what shouldi be looking for?
<FromGitter>
<girng> ok so it looks like ` 20 0 1721M 8684 3016 S 2.0 0.1 0:00.27 /home/girng/.cache/crystal/crystal-run-GameServer.tmp` goes to around 10% CPU while the games are created. then it goes back to 0%, when the fibers stop
<FromGitter>
<girng> ok, checked syslogs after i ran gameserver, not seeing anytihng about open files or any errors that would cause the tcp io hiccup. am not sure what to do
faustinoaq has joined #crystal-lang
duane has joined #crystal-lang
Yxhuvud has quit [Read error: Connection reset by peer]
Yxhuvud has joined #crystal-lang
alex`` has quit [Quit: WeeChat 2.1]
pabs_ has quit [Ping timeout: 260 seconds]
alex`` has joined #crystal-lang
pabs has joined #crystal-lang
<FromGitter>
<phoffer> Hey everyone, sorry I haven’t been around for quite a while. I was wondering if there is any news regarding using Crystal for Ruby native extensions? I’ve just received serious interest from someone at a very large Rails company, so it looks like I will be resuming work on my crystalized_ruby project soon :) I just wanted to check in the community first, no reason to duplicate or compete against other
<FromGitter>
... people’s efforts
<FromGitter>
<S-YOU> Great, expecting libgen and crystal_lib improves better too.
<FromGitter>
<faustinoaq> > I was wondering if there is any news regarding using Crystal for Ruby native extensions? ⏎ ⏎ @phoffer Sadly not yet 😓
faustinoaq has quit [Quit: IRC client terminated!]
<FromGitter>
<phoffer> @faustinoaq both the slides and the POC were inspiration for my https://github.com/phoffer/crystalized_ruby 😄 but it needs a lot of re-working to be compatible with current crystal
<FromGitter>
<faustinoaq> @phoffer Oh, nice, I think crystal-ruby extension is a good things, although actually the community is more focused in get some things done (parallelism, windows, stable)
<FromGitter>
<phoffer> Oh yeah those are all absolutely more important. There’s been some chatter in the past, so I wanted to make sure I didn’t miss anything. But it is rightfully wayyyy down the list of priorities (if it even still is listed)
<FromGitter>
<girng> :( :( :(
<FromGitter>
<girng> `crystal build --debug test.cr && ./test`. where is my debug log file at?
<FromGitter>
<phoffer> Additionally, I think it’s something that should be cared about more by the Ruby community. It’s not Crystal’s responsibility to get itself embedded in Ruby. I don’t think it’s reasonable to expect Crystal team to create that
<FromGitter>
<girng> is it possible to print out debugging information to a file with a compiler command?
<FromGitter>
<faustinoaq> > (if it even still is listed) ⏎ ⏎ @phoffer Yeah, I think is still listed somewhere 😅
<FromGitter>
<faustinoaq> > where is my debug log file at? ⏎ ⏎ @girng Embedded within your executable
<FromGitter>
<faustinoaq> Crystal doesn't generate debug files like C# yet
<FromGitter>
<elorest> @phoffer glad to see you're still in the crystal community.
<FromGitter>
<elorest> Are you still in northern utah?
<FromGitter>
<elorest> We're putting together a crystal meetup next wednesday if you'd be interested.
<FromGitter>
<phoffer> That’s putting it nicely Isaac 😓 I’ve been absent quite a while but I do follow as I can. Yes still in town, although I’ll be moving down to Tucson next month. Ironic I know 😄 Where is that meetup planned? I’ll have to check if I can make it
<FromGitter>
<elorest> @phoffer it will be at slingshot in Orem.
<FromGitter>
<elorest> I'm also moving the AZ next month lol.
<FromGitter>
<faustinoaq> @girng It Stopped here ^^
<FromGitter>
<girng> @faustinoaq ohhhhh i see. so it does bottom out for you too, but at a higher rate. so it's prob how my code is structured. bcz it should continue to send messages to you the entire time.. i wonder what's stopping the loop in the `tick_rate` fiber
<FromGitter>
<faustinoaq> Ok, I added more clients (6 more) ^^
<FromGitter>
<girng> yah, aint no bottleneck at all then. something going on with the loop in the fiber i think
<FromGitter>
<girng> it's being closed... iuno how lol
<FromGitter>
<girng> this aint io issue or cpu/memory issue either. i just checked iotop on my debian VPS. it shows nothing. i think it's the way i structured the server possibly 😆
<FromGitter>
<faustinoaq> @girng No resources issues, my machine is working fine 😅
<FromGitter>
<faustinoaq> The 5GB usage is because chrome 😅
<FromGitter>
<girng> 😅 haha thx for testing it bro, helps a lot :D
<FromGitter>
<faustinoaq> I almost have 50 open tabs 😆
<FromGitter>
<girng> im gonna re-factor and start fresh i think
<FromGitter>
<faustinoaq> @girng BTW, Actually the server output didn't stop, just keep printing the same message
<FromGitter>
<faustinoaq> @girng BTW2, I consider my CPU is quite slow (1.3 GHz Intel Celeron late 2014) plus 8GB DD3L RAM
<FromGitter>
<girng> @faustinoaq something is really screwy. because i just did 1 game, and let the tick_rate run for 5 minutes, only got up to 17,000 messages sent, then stopped (Same for game iteration). i think something is triggering the tick_rate fiber and closing it. not sure what it is
qard has joined #crystal-lang
<FromGitter>
<faustinoaq> I think WSL is pretty slow 😅
<FromGitter>
<girng> @faustinoaq im testing it on my vps too, cause stupid iotop didn't work on WSL 😄
<FromGitter>
<girng> i tihnk my vps is slower xDD
<FromGitter>
<faustinoaq> @girng Why don't try to install some linux distro in your machine? 😅
<FromGitter>
<faustinoaq> I also have Windows 10 in my machine, I have a partition with Manjaro Linux
<FromGitter>
<faustinoaq> And works pretty nice. I'm using just 20GB for Linux partition, all remaining space is for Windows 😅
<FromGitter>
<faustinoaq> I still need Windows to work with Visual Studio and .Net 😅
<FromGitter>
<girng> @faustinoaq not sure. i have a love hate relationship with WSL don't really want to leave it yet. but i heard of manjara linux is popular in the godot community as well, alot of people use it hahah
<FromGitter>
<faustinoaq> I still prefer Manjaro Linux. though
<FromGitter>
<faustinoaq> My partition looks like this (Yep, I know, "what a mess" 📡 )
<FromGitter>
<girng> haha
early has quit [Quit: Leaving]
early has joined #crystal-lang
qard has quit [Quit: qard]
rohitpaulk has joined #crystal-lang
sagax has quit [Quit: Konversation terminated!]
qard has joined #crystal-lang
<FromGitter>
<girng> @faustinoaq i think i fixed it. issue was at line 44 here: https://paste.ee/p/JIKlx in the tick_rate. all the `200` games was basically using write_bytes, and send, on the same socket. which at 15hz is 3000 times a second lol. what i did was just replace 200 with `1`, and then on socket, i am using: https://paste.ee/p/jC1Ua which just creates 50 connections. each connection is getting its socket written at
<FromGitter>
... a 15hz interval (which is normal). now i'm at `Games Open: 1. Game Iterations: 358380, Msgs Sent: 358380`, on this 600MHz cpu. and still going up! so it's working now, with 50 connections. cpu at 20% tho lol
<FromGitter>
<girng> In any event, the new server: https://paste.ee/p/Y5ggo, socket: https://paste.ee/p/FXe9P im at 50 games open, and at 20% cpu on the VPS. i'm going to go higher hopefully this VPS host doesn't ban me LOL
qard has quit [Quit: qard]
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 240 seconds]
rohitpaulk has joined #crystal-lang
hightower2 has joined #crystal-lang
rohitpaulk has quit [Ping timeout: 256 seconds]
Raimondii has joined #crystal-lang
Raimondi has quit [Ping timeout: 268 seconds]
Raimondii is now known as Raimondi
alex`` has quit [Quit: WeeChat 2.1]
<FromGitter>
<vladfaust> Hi. Is there a way to create SHA1 hash from string with given salt? Ruby's `scramble = ::OpenSSL::Digest::SHA1.new(salt).update(pass).digest`
<FromGitter>
<manveru> in other words, just append the strings, same effect
<FromGitter>
<vladfaust> Oh great, thank you very much!
<FromGitter>
<vladfaust> And the last question, if I may: how to `xor(string1, string2)`?
<FromGitter>
<manveru> `"a".bytes.zip("b".bytes).map{|(a,b)| (a | b).chr }` like this?
<FromGitter>
<manveru> i'm sure there's a better way... i'm not good at byte fiddling
<FromGitter>
<vladfaust> @manveru if you're "not good", I'm zero. I'll take yours, thanks. But if anyone have a better solution, please share
<FromGitter>
<yxhuvud> Isn't that or and not xor?
<FromGitter>
<vladfaust> My task has been simplified, I now need to xor two `Bytes` (`Slice(UInt8)`), which must be easier
<FromGitter>
<manveru> ah, true
<FromGitter>
<manveru> so it needs `^` instead
<FromGitter>
<vladfaust> I'm getting the overall concept of XOR, I need to perform byte-by-byte XORing of each UInt8 within the `Slice`. But what's the final result of XORing two `Slice`s?
<jsn->
a hash of concatenation of salt and data is usually not a very good idea cryptograhically, you should consider using hmac instead
<mps>
is there list of crystal operators, with (even short) description, somewhere
<FromGitter>
<vladfaust> @jsn- thanks, but it doesn't depend on me atm :)
<FromGitter>
<forkev_twitter> @z64 & @wuehlmaus - the reference to strip through me for a loop too, as given the context of the crystal documentation you'd think this was a compile flag. After some head scratching, I found it's an external tool, aka, review https://sourceware.org/binutils/docs/binutils/strip.html for post processing the compiled binary.
<z64>
yeahh, i tried it myself in my terminal after that on a whim. thanks for clarifying though
<FromGitter>
<forkev_twitter> very cool. thank you Faustino. I've not seen these.
<FromGitter>
<faustinoaq> by dom96 😉
<wuehlmaus>
faustinoaq: great link, thanks a lot
<wuehlmaus>
forkev_twitter: i knew strip for a long time, i just thought that --release would have done that automatically. I really learned something today.
<FromGitter>
<vlazar> Does anybody know any Crystal hards for generating MS Word documents? I see there are some for PDF, but found nothing for DOCX :( I need template based document generation, simple placeholder replacements but also loops and conditionals.
<FromGitter>
<manveru> @vlazar if you got a lib for reading zips, just unpack and replace that way?
<FromGitter>
<vlazar> You mean DOCX is just an XML file and suggest to use XML to work with it? I thought maybe are some some higher level libs for that. Trying so sneak Crystal in for my task if possible :)
<FromGitter>
<manveru> yeah, basically, unzip and work with the XML... i don't think i've seen a lib for specially for docx
<FromGitter>
<vlazar> yeah, sounds like a lot of fun :) might try this or maybe stick to Ruby for now
<wuehlmaus>
i have an Apple and i have to always link libressl or brew openssl to my http/client stuff because /usr/lib stuff is too old. Is there a trick to always do it without using some shell script?
<wuehlmaus>
i have to do --link-flags '-I/usr/local/opt/libressl/include -L/usr/local/opt/libressl/lib'
<wuehlmaus>
yet https stuff is so omnipresent nowadays and i always do the same
<FromGitter>
<manveru> for static linking?
<wuehlmaus>
until now i solve it via a shell script
<wuehlmaus>
no, not static linking
<FromGitter>
<manveru> i just had a coworker trying to compile our webserver and he had to export some pkgconfig path env var
<FromGitter>
<manveru> because it couldn't find ssl either
<FromGitter>
<manveru> never had that issue in nix-shell
<FromGitter>
<vladfaust> When doing `Benchmark.measure`, which output value is relevant?
<FromGitter>
<vladfaust> Like, elapsed real time?
<FromGitter>
<vladfaust> I mean, is "system CPU time" relevant to benchmarking performance?
<FromGitter>
<vladfaust> I constantly thinking that I'm asking stupid questions 😟
<hightower2>
vladfaust: system CPU time is amount of time spent executing syscalls in kernel (as opposed to user CPU time which is everything else). You are interested in the sum (3rd field)
<oprypin>
vladfaust, well at least this one is not a stupid question. i don't know it either. though maybe it's possible to find generic information online
<FromGitter>
<vladfaust> Thank you, guys, gonna use the 3rd value (googled more thoroughly)
<oprypin>
vladfaust, me personally i'd look at real time in brackets
<oprypin>
it's what i care about -- "how long would I need to sit there waiting for the result" -- as I understand it
<hightower2>
Yes, but that time (4th time) is, from what I understand, the "wall clock" time. And if you're running anything else on the computer so it's busy, this time may be longer than realistic
<oprypin>
but I think the non-real numbers can exceed real numbers when parallelism is involved
<oprypin>
and you wouldn't want to penalize an efficient parallel implementation
<hightower2>
Nice one. But still, maybe it would be possible to argue that you want to be looking at how much time on the CPU the entire job took. Whether this work was parallelizable so it actually ended sooner in real time, could be a different matter..
<FromGitter>
<vladfaust> @oprypin I see, will remember this
<hightower2>
Can I (if yes, how) check in runtime if a method on an object exists?
<FromGitter>
<jwoertink> You could patch Object with a methods method using {{ @type.methods }} and some other stuff, then see if that array contains the method you're looking for...
<FromGitter>
<jwoertink> Might be an easier way, but that was my first thought
chumlee has joined #crystal-lang
<hightower2>
jwoertink: oh I know, the method is basically in relation to an instance var, if the var doesn't exist the method doesn't either. I'll check the instance var (will construct the name inside the macro) and that'll do
<FromGitter>
<bew> what's your usecase?
<hightower2>
I am in a macro. I have {{ call.name }} which is the string I start with. Then I need to prefix it with something, like {{ "test_" + call.name.stringify }}, and check if method of that name exists on some object. If yes, I call it, if not I call next.
<oprypin>
ok but would you please explain what you're actually trying to do
<oprypin>
you promised that 24 hours ago
<FromGitter>
<bew> ah so that's not runtime
<hightower2>
bew: yes, well, the macro generates some def()s which actually run in runtime. But I have the convenience of macro generating it, so... yeah
<hightower2>
oprypin, hehe, I know. In essence I am porting some code over... specifically the code that registers listeners and then emits events. I used papierkorb's "cute" module for events in Crystal and am now trying to brige the gap between the original code's behavior and what I can do with cute
<hightower2>
bridge*
<hightower2>
not sure how else / more closely to describe it without going into ugly specifics :)
<oprypin>
that just tells me that possibly you know what you're doing and that maybe i don't really want to know after all
chumlee has left #crystal-lang [#crystal-lang]
<hightower2>
I think I got it working, except one last bit. Which is that if I emit signal "x", then after calling all its listeners, the code prepends a word to it (like "element_x") and then goes to call that modified name on all parent objects
<FromGitter>
<bew> we have noo idea what you're talking about
<hightower2>
Ok (that's why I didn't bother explaining earlier). Thanks for help.