<jhass>
dscrd: bin/crystal build --cross-compile "linux i686" src/compiler/crystal.cr --target i686-pc-linux-gnu --release -o crystal32 is how I bootstrapped for a 32bit build
<jhass>
that gives you a .o and the command to link it
dscrd has quit [Ping timeout: 240 seconds]
unshadow has quit [Quit: leaving]
dscrd has joined #crystal-lang
hosiawak has quit [Ping timeout: 255 seconds]
<dbackeus>
any good ways of seeing how expanded code looks like after macros have been applied?
<jhass>
dbackeus: mmh, maybe crystal browser works again
<jhass>
you can add {{debug()}} inside a macro to dump it
<dbackeus>
where do I find crystal browser?
<dbackeus>
debug was helpful!
<jhass>
dbackeus: just crystal browser some_code.cr
<jhass>
and yeah, that appears to be after macro expansion
<jhass>
though doesn't show class level code apparently :/
<dscrd>
nothing about bootstrapping, eh? :)
<dscrd>
I suppose somebody using freebsd might be interested in this question also
<dscrd>
I would guess somebody porting to that platform would have identical troubles
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 264 seconds]
<dscrd>
seems like there are quite a lot of old open issues in the tracker
<dscrd>
I hope nobody gets insulted if I would go through them a bit
<dscrd>
(a bit later when I'm on my own computer)
<jhass>
dscrd: seen my reply?
<dscrd>
jhass: sorry, missed it due to network cutoffs
<jhass>
dscrd: bin/crystal build --cross-compile "linux i686" src/compiler/crystal.cr --target i686-pc-linux-gnu --release -o crystal32 is how I bootstrapped for a 32bit build
<dscrd>
ok, so that might work from a system that has both musl and glibc
<dscrd>
I'll explore that later today, thank you :)
<dscrd>
but then again, I wonder how I can target another libc via that
<dscrd>
probably would need a bit more magic
<dscrd>
but I'll see if I can figure it out
<dscrd>
gotta go now
dscrd has quit [Quit: leaving]
dwahl has quit [Quit: Leaving]
dwahl has joined #crystal-lang
havenwood has joined #crystal-lang
Ven has joined #crystal-lang
luislavena has joined #crystal-lang
vifino has quit [Ping timeout: 246 seconds]
vifino has joined #crystal-lang
endou_ has quit [Read error: Connection reset by peer]
endou has joined #crystal-lang
eam has quit [Ping timeout: 252 seconds]
eam has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
<jhass>
asterite: so watcha think, would http://carc.in/#/r/8ue be a fun macro for stdlib?
<BlaXpirit>
:o
<BlaXpirit>
looks cool
<dwahl>
fun or functional?
<BlaXpirit>
why not both
<jhass>
shouldn't the aim be at both? :P
<jhass>
I'd love it as a macro def on Object, but given Crystal doesn't interfere the return type of those :/
<jhass>
well or rather I'd like to see something like a mix of macro def and the method_missing macro, dynamically create uniquely (or anonymous) methods for each invocation (or each invocation with a different parameter)
<jhass>
would also allow to do instance_variable_get and the like
strcmp1 has joined #crystal-lang
strcmp1 has quit [Remote host closed the connection]
guilleiguaran__ has quit [Remote host closed the connection]
emmanueloga has quit [Remote host closed the connection]
iamstef has quit [Remote host closed the connection]
AckZ has quit [Remote host closed the connection]
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
shama has joined #crystal-lang
guilleiguaran__ has joined #crystal-lang
NeverDie has joined #crystal-lang
blue_deref has joined #crystal-lang
mgarciaisaia has quit [Quit: Leaving.]
<vifino>
Does Crystal have some kind of Timeout library, like Ruby?
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass>
if you'd want to use threads on your own and IO in them, you'd have to go back to Crystal 0.6.1, which is prior the evented IO stuff
<sdogruyol>
jhass: no i dont wanna use threads i just wanna have channels which utilizes all the cpu juice :D
<sdogruyol>
jhass: like go's
<jhass>
yes, as said that's the plan forward, just not there yet
<sdogruyol>
jhass: hope so. But is that possible with a single threaded event loop?
<jhass>
I haven't looked at libevent2, but wouldn't be surprised if it has interfaces to make it possible
<sdogruyol>
jhass: wonder how go achieves that :|
<sdogruyol>
jhass: guess their scheduler is pretty neat
<asterite>
I think it doesn't matter if there's a single thread
<asterite>
when IO blocks, the runtime schedules that fiber for later, so you can have IO concurrency with one thread
<asterite>
and if this is a benchmarking tool that will do multiple requests "in parallel", it'll work fine (I think): when a request blocks, another will start, then it'll block, another will finish and the code will resume, etc.
<sdogruyol>
asterite: hey thanks for the answer. I'm trying to write a http benchmark tool with channels and theoritically you are right about waiting
<asterite>
But in practice it's slow?
<sdogruyol>
asterite: yeah
<sdogruyol>
asterite: or i maybe doing something utterly wrong :)
<sdogruyol>
asterite: to compare i use wrk. For example the one i wrote in crystal does like 7k rps. wrk performs more than 10x at around 70-80k rps
<sdogruyol>
asterite: meanwhile the server is a simple hello world server written crystal :)
<asterite>
Yes, I'm currently seeing same results on my machine
<sdogruyol>
asterite: what are you using for crystal
<asterite>
sdogruyol: text editor?
<sdogruyol>
asterite: ah i meant how did you compare the results on your machine
<asterite>
Oh, hello world server in crystal, but using ab instead of wrk
<sdogruyol>
asterite: ah i see :)
<asterite>
If I create an HTTP::Client and then use that same client for the requests, I get about 20_000 req/s
<asterite>
instead of 2_000 req/s
<asterite>
So, HTTP::Client.get will open a socket and close it, each time
<asterite>
Now I get similar results to ab. Mmm... a bit faster using the new-fibers branch (does context switch with inline asm). Probably there are other things to optimize
<sdogruyol>
asterite: it works like a charm <3 You rock :)
<sdogruyol>
asterite: now i'm getting nearly 30k rps
<asterite>
Awesome! I wonder what will happen once we have multiple threads running those fibers
<sdogruyol>
asterite: i cant even imagine that :P
<sdogruyol>
asterite: btw ary what shall i do if i dont want to pass anything between channels like i do now
<asterite>
One option is to use Channel(Nil) and send.nil. Another option would be to write a wrapper around channel, probably a struct so it's lightweight. I can imagine something like that in the std
<sdogruyol>
asterite: is there any performance difference between Channel(Int32) and Channel(Nil)
<asterite>
I don't know, I'll have to benchmark it
<sdogruyol>
asterite: okay
<sdogruyol>
asterite: thanks a lot :)
<asterite>
sdogruyol: thanks for your support and the nice cryload project :)
<sdogruyol>
asterite: you're welcome :) Wish i could do more
<BlaXpirit>
so
<BlaXpirit>
are there any new tutorials for crystal?
<jhass>
a talk or two
<jhass>
check the subreddit :P
<BlaXpirit>
I feel helpless and see no way to extensively learn Crystal
<jhass>
mmh, well I always need a project to do
<BlaXpirit>
the talks are just very basics and showcases
<BlaXpirit>
0 documentation for majority of functions sucks :/
<jhass>
but if that's your issue: how about contributing documentation?
<BlaXpirit>
it sure is true
<jhass>
makes you read through stdlib and figure out what they do
<BlaXpirit>
jhass, haha if i have trouble understanding then how can i document it
<jhass>
try it
<jhass>
ask your questions here
<BlaXpirit>
also: writing documentation is one of my most hated things
<jhass>
right, still a low hanging fruit
havenwood has quit [Read error: Connection reset by peer]
<BlaXpirit>
nono, writing documentation for a stdlib that was inspired by ruby is much better done by a rubyist
<jhass>
well, if you read ruby's stdlib docs you'd maybe think otherwise :P
<sdogruyol>
BlaXpirit: most of the time i read the rubydocs lol
<jhass>
I mean it's still only documented to 75%
<BlaXpirit>
i took a bit of time to remember ruby
<BlaXpirit>
but i have 0 interest in using it
<sdogruyol>
BlaXpirit: what's your language of choice then
<BlaXpirit>
Crystal :p
<BlaXpirit>
well it's the language i'm betting on
<sdogruyol>
BlaXpirit: that's a good one
<BlaXpirit>
normally I use Python
<sdogruyol>
BlaXpirit: but arent you using anything other than crystal
<sdogruyol>
BlaXpirit: now that's rare to hear :P
<sdogruyol>
BlaXpirit: a python dev who doesnt like to write docs
<jhass>
haha
<jhass>
yeah, I always have a feeling of missing the point in the wall of text that are python docs :P
<sdogruyol>
jhass: hahah wall of text nice one :D
<sdogruyol>
btw guys
<sdogruyol>
what do you do for cross compiling crystal e.g from mac to linux
<jhass>
BlaXpirit: my advice stands, pick a project, before implementing something that could be a method in stdlib look if you find something and/or just ask here
<jhass>
dscrd: bin/crystal build --cross-compile "linux i686" src/compiler/crystal.cr --target i686-pc-linux-gnu --release -o crystal32 is how I bootstrapped for a 32bit build
<jhass>
er, disregard the dscrd:, still had it in my history :P
<sdogruyol>
jhass: oh let me try it for 64 bit
<jhass>
there's an official 64bit linux tarball
<jhass>
and repos for debian/ubuntu and I think rpm too
<sdogruyol>
jhass: btw my question was flawed
<sdogruyol>
jhass: i meant i want to cross compile my crystal project from mac to linux
<jhass>
uh
<jhass>
well above will work too
<jhass>
though just getting a VM and a native crystal compiler in there is probably easier
<sdogruyol>
jhass: why?
<jhass>
you'll have to install all the dependencies anyway, so it's git clone your_project; crystal build ...; vs crystal build --cross-compile ...; scp ...; copy linker invocation; ssh ...; paste linker invocation
<jhass>
btw there's no other channel traffic, no need to highlight with every message ;)
<sdogruyol>
jhass: ah that's a habit of mine :| I use slack, hipchat a lot lol
nahtnam has joined #crystal-lang
<sdogruyol>
jhass: why do i have to install all the dependencies and what do you mean by all?
<jhass>
so you can link against them
<sdogruyol>
jhass: oh
<jhass>
the linking is still done at the target, since your system doesn't have the libraries to link against
<sdogruyol>
jhass: dont we statically link them into one single binary :O
<jhass>
nope
<sdogruyol>
jhass: now i learnt it :P
<jhass>
and even if we did that would change nothing about it
<dbackeus>
on the subject of single threaded... any tips for a simple / extremely fast load balancer to hit multiple crystal http server processes?
<sdogruyol>
jhass: how golang does that then :S
<jhass>
the other path is to download all the libraries for the target system to your host... which is an even greater hassle
<sdogruyol>
jhass: oh
<jhass>
I never used Go, let alone crosscompiled with it
<jhass>
doubt they do it any differently
<sdogruyol>
jhass: that's what i do for crosscompiling go stuff
<sdogruyol>
jhass: :D
<sdogruyol>
jhass: dl all the target builds and then cross compile
<jhass>
dbackeus: the usual stuff should be fine, nginx, ha-proxy
<sdogruyol>
dbackeus: haproxy
<sdogruyol>
jhass: btw go sucks as a language i dont like it
<jhass>
yeah, I suspect Crystal is the language the Rubyists migrating to Go actually wanted :P
<sdogruyol>
jhass: hahahah that's right :D
<sdogruyol>
jhass: i'm gonna quote this on twitter :P
<sdogruyol>
asterite: i'll try to find some good tutorial if there's any :P
<sdogruyol>
if anything interesting happens i'll try to post to this site in japanese
<asterite>
sdogruyol: are you fluent in japanese?
<sdogruyol>
asterite: yes
<asterite>
how?
<sdogruyol>
asterite: like i can talk to japanese people without even any accent :P
<sdogruyol>
asterite: and they mistook me for a japanese
<sdogruyol>
:D
<asterite>
:-O
<asterite>
Did you took classes?
<asterite>
I definitely didn't take English classes, given that last question :-(
<sdogruyol>
asterite: well i just took introductory classes for half a year and then self studied
<sdogruyol>
asterite: lol your english is really OK
<asterite>
How did you self studied? I'm asking because I also took japanese classes, but they weren't good and I don't know how to self study it... or what's the best way to do it
<sdogruyol>
asterite: well let me see
<dbackeus>
haproxy loadbalanced over 4 server instances: 14 000 req/sec
<dbackeus>
vs
<dbackeus>
1 server instance = 40 000 req/sec
<sdogruyol>
asterite: i always demanded additional resources from my teacher and started learning kanji from kindergarden books
<sdogruyol>
asterite: and then i studied kanji each day
<dbackeus>
guess haproxy is the bottleneck :/
<sdogruyol>
dbackeus: you need to configure it properly :P
<sdogruyol>
asterite: i also had lots of japanese friends online and talked with them a lot
<sdogruyol>
dbackeus: i'm not sure if roundrobin is best for your case
<dbackeus>
you mean there are other ways which are faster for haproxy?
<dbackeus>
roundrobin seems like a pretty straight forward algorithm :P
<sdogruyol>
dbackeus: yeah there are :P
<sdogruyol>
dbackeus: you have to read :P
<sdogruyol>
dbackeus: if not you can try nginx
<sdogruyol>
dbackeus: it's much more easier
<dbackeus>
I'm really just looking to see how many rps I could get of crystal could utilise all of the cores, easiest possible one liner load balancer would do ;)