jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.12.0 | Fund Crystals development: http://is.gd/X7PRtI | Paste > 3 lines of text to https://gist.github.com | GH: https://github.com/manastech/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Logs: http://irclog.whitequark.org/crystal-lang
trapped has quit [Read error: Connection reset by peer]
elia has quit [Quit: Computer has gone to sleep.]
nnil has joined #crystal-lang
<nnil> hi
ssvb has quit [Read error: Connection reset by peer]
ssvb has joined #crystal-lang
<jokke> hi nnil
<jokke> asterite: is this a bug? https://p.jreinert.com/JVR/
<jokke> the get macro is not on top level
Dreamer3_ has joined #crystal-lang
triangles has joined #crystal-lang
nnil has quit [Ping timeout: 240 seconds]
A124 has quit [Read error: Connection reset by peer]
A124 has joined #crystal-lang
rmosolgo has joined #crystal-lang
x0f has quit [Ping timeout: 268 seconds]
x0f has joined #crystal-lang
rmosolgo has quit [Remote host closed the connection]
Guest71168 is now known as Cyrus
Cyrus has joined #crystal-lang
Cyrus has quit [Changing host]
Dreamer3_ has quit [Quit: Computer has gone to sleep.]
Dreamer3_ has joined #crystal-lang
tatey_ has joined #crystal-lang
<tatey_> Hey. I've been trying to rebase my PR (https://github.com/manastech/crystal/pull/1820) against master and run the tests. When I run the tests I get a clang error. Any idea what's going on? https://gist.github.com/tatey/82f7ef75532a75671441
<tatey_> I've got to run, but I've left a comment on the PR :-)
tatey_ has quit [Quit: Textual IRC Client: www.textualapp.com]
Philpax has quit [Ping timeout: 240 seconds]
rmosolgo has joined #crystal-lang
rmosolgo has quit [Ping timeout: 240 seconds]
srenatus has joined #crystal-lang
srenatus has left #crystal-lang [#crystal-lang]
trapped has joined #crystal-lang
Dreamer3_ has quit [Quit: Computer has gone to sleep.]
nnil has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
nnil has quit [Ping timeout: 240 seconds]
<jokke> anyone else have some idea about the backtrace from my paste?
r00takaspin has joined #crystal-lang
r00takaspin has quit [Client Quit]
<BlaXpirit> jokke, are you sure that the whole backtrace?
<BlaXpirit> >> error
<DeBot> BlaXpirit: undefined local variable or method 'error' - https://carc.in/#/r/sni
<BlaXpirit> uhhh nevermind
r00takaspin has joined #crystal-lang
elia has joined #crystal-lang
r00takaspin has quit [Client Quit]
r00takaspin has joined #crystal-lang
<jokke> BlaXpirit: no it's not.
<jokke> BlaXpirit: just a sec
<jokke> there
r00takaspin has quit [Client Quit]
<BlaXpirit> lol
<jokke> BlaXpirit: hm?
<sdogruyol> jokke: how do you integrate this with kemal?
<sdogruyol> have you tried?
<jokke> sdogruyol: not at all yet
<sdogruyol> oh i see
<jokke> sdogruyol: i just tried running the specs
<jokke> and to go from there
<jokke> i have a project similar to kemal
<jokke> which uses macros like that for routes
<jokke> but i didn't know about radix back then
<jokke> so i kind of wanted to give it a shot to merge some parts of my project into kemal and see where that takes me
<sdogruyol> i see
<sdogruyol> imho something like grape or jbuilder would be awesome
<sdogruyol> and i see that you’ve done that hard part of generating complex json
<sdogruyol> good job
<jokke> sdogruyol: sure but being able to define routes with a controller and action is a pretty powerful option imho
<jokke> and grouping too
<sdogruyol> yeah
<jokke> especially the controller part since it would allow the usual oo programming patterns
<jokke> sdogruyol: here're my modifications btw: https://p.jreinert.com/lYDj/ruby
<jokke> the require "./dsl" is nonsense of course. it just was a deperate attempt of making the macro expansion work
<sdogruyol> this looks interesting
<jokke> there is one drawback to the current implementation though. If one does the usual get "/foo" do ... end, they cant affekt the name of the context variable passed to the block
<jokke> *affect
<sdogruyol> how so?
<jokke> because macros can't have named block params
<sdogruyol> i need to take a deeper look at your macro
<sdogruyol> :)
<jokke> so they can do get "/foo" do ... end but the name of the context variable will always be context and there's no way to rename it with get "/foo" do |my_context| ... end
<sdogruyol> https://github.com/ruby-grape/grape Grape is a great example that it can mount on Rack, Rails or Sinatra e.g
<jokke> it's just the way macros treat blocks
<jokke> yeah
<sdogruyol> i think the thing you build should be firstly compatible with Crystal HTTP and then later Kemal or others
<jokke> sdogruyol: what i'd really like to see in kemal is being able to transform the return values of the path blocks with filters
<sdogruyol> can you given an example of that?
<jokke> yeah
<sdogruyol> you can modify the context
<jokke> yeah i know
<jokke> but the return value of the blocks are to_ssed and passed to context.response.print, right?
<sdogruyol> yeah correct
<jokke> there's no way to modify it after that since it's an io
<sdogruyol> well you can flush and rebuild it as you want
<sdogruyol> but that’d be expensive to dos
<sdogruyol> so*
<jokke> yeah
<sdogruyol> but it’s a trade-off i guess. If you want that much of flexibility that’s acceptable (or not?)
<jokke> my point is that it would allow building a lot more powerful middleware if there would be something like BodyHandlers or so that could modify the body and pass it along the chain and at the very end it would be written to the response
<jokke> even better imho would be a handler that would be passed both the context and the body to it's call method
<sdogruyol> what if you would want to write something to context in the middle?
<jokke> yeah that'd be possible
<jokke> ah you mean to the body?
<sdogruyol> what if a buffered body existed?
<jokke> yeah that's a problem
<sdogruyol> or what if we build all the middlewares as buffered and then call to_s only at the end?
<sdogruyol> that sounds like a good idea but need to give it a try
<jokke> what do you mean with buffered?
<jokke> i think it's only powerful if the content can be any value until the very end
<sdogruyol> yeah
<sdogruyol> that means can be anything / can be modified anytime till the very end right?
<jokke> so, to come back to my json api example, i could write a middleware which would check if the content is a JSONApi::Response, set headers and return codes and serialize the response
<jokke> yeah
<jokke> exactly
<sdogruyol> for Kemal creating a special Handler and making every middleware inherit from that Handler instead of HTTP::Handler would make it possible
<jokke> yes
<jokke> and it wouldn't rule out writing normal middleware either
<jokke> normal meaning HTTP::Handler
<sdogruyol> well practically we’ll define an interface for others to comply
<jokke> yes
r00takaspin has joined #crystal-lang
<jokke> sdogruyol: would you like me to try something regarding this middleware handler?
<sdogruyol> that’d be interesting
<sdogruyol> but currently i have no vague idea about how it should be :P
<jokke> ok, i'll try some things out
<sdogruyol> great! Thanks :)
<jokke> np :)
<sdogruyol> i’ll try jsonapi soon
<jokke> cool :)
<sdogruyol> i’ve a pretty huge (and slow) JBuilder template. Which would be a really great use case for this
<sdogruyol> it takes around 2 secs to render thanks to Rails :P
<jokke> yeah tell me about it...
<jokke> we use active model serializers at work...
<Netfeed> ~
<jokke> it takes _ages_ for any significant amount of data to render
<sdogruyol> well JBuilder is abysmally slow
<jokke> haven't heard about JBuilder before
<sdogruyol> i rendered that with JSON.builder in Crystal
<jokke> just about rabl and active model serializers
<sdogruyol> the code was a horror but the speed was like 100x faster
<jokke> haha
<sdogruyol> 2 sec went down to 20 ms :P
<jokke> yeah well JSON Api is very specific though.. it's designed to render json conforming to the json api spec..
<sdogruyol> I’ve tried AMS for the same template and it did increase only %10 so i gave up on the switch
<jokke> but you might be able to reuse some components
<jokke> the the caching for example
<sdogruyol> yeah i know but still that slowness bothers me :(
<jokke> 20ms is pretty good?
<jokke> depending on the size of the json and complexity of the data of course
<sdogruyol> Yeah
<jokke> i'm getting max 200 serializations per second for rendering a roughly 500 KiB JSON of objects with random data
<jokke> that's the raw throughput without any io
<sdogruyol> hmm
<sdogruyol> why is that so slow?
<jokke> do you think it's slow?
<jokke> that's 5ms in average
<jokke> i really doubt that it's the bottleneck. fetching data from the db and actually writing the data to the socket will take much longer in comparison
<jokke> and that json would be the equivalent of quering 1K rows/documents from a db
<jokke> Without any caching i'm at 50 serializations per second btw
<jokke> that'd be your 20ms
<jokke> but i'd suggest try it out with real world use cases and see what it can do. That's what i'm planning to do in the next couple of days now. I'm writing my bachelor thesis about a system with a caching api and reactive ui.
<jokke> ui will be a redux app. I must say webpack, es6 and redux makes even javascript bearable :)
<sdogruyol> jokke: that sounds great
<sdogruyol> can you show me the json for your serialization benchmark?
<jokke> heh i never outputted it before. wait a sec
pawnbox has joined #crystal-lang
<jokke> sdogruyol: would you like me to pretty print it?
<jokke> i should say that's not possible with the caching. or it kind of is, but may look weird since a cached portion might have wrong indentation
<sdogruyol> sure
<jokke> so i'll pass it through ruby -r json -e 'JSON.pretty_generate(JSON.parse(STDIN.read))'
<jokke> oh i actually get 250 per second
<jokke> wow i'm pretty impressed about ruby's json libs speed..
<jokke> that command was instantanious
<jokke> anyhow. here's the json https://p.jreinert.com/usbi/
<jokke> you might want to view it raw
<jokke> anyhow. here's the json https://p.jreinert.com/usbi
<sdogruyol> let me check
<jokke> oh it seem's id is always 0
<jokke> wait a sec
<jokke> allright that should make a more interesting json
<jokke> whoa
<jokke> serious performance drop
<jokke> and no profit from cache :(
<jokke> getting 35 per second now
<jokke> but json is also larger
<jokke> 711 KiB
<jokke> haha i might want to uniq the friends
<jokke> ah
<jokke> uniq vs uniq!
<jokke> here we go again
<jokke> no effect on performance though
<jokke> did you know that you can profile crystal code perfectly with kcachegrind?
<jokke> ok this should be fine: https://p.jreinert.com/nYWhlQ
<jokke> ok but i'm not that discouraged. it _is_ a pretty big json containing data with a relatively high entropy which makes it pretty hard to cache
<jokke> i still wonder why it doesn't profit at _all_ from caching
<jokke> maybe i should think about the caches cleanup method a bit more...
<jokke> hm i think it's because i'm trying to cache the whole request
<jokke> which would itself amount to > 700Kib
<jokke> so in order to store it in the cache it has to cleanup everything else
<sdogruyol> jokke: i use os x
<sdogruyol> meanwhile i have an alike json so it’s pretty fair to compare the speed
<sdogruyol> 35 per second seems great
<jokke> mhm
trapped has joined #crystal-lang
r00takaspin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
elia has quit [Quit: Computer has gone to sleep.]
ssvb has quit [Remote host closed the connection]
Philpax has joined #crystal-lang
r00takaspin has joined #crystal-lang
elia has joined #crystal-lang
<jokke> any idea why this might be deadlocking? https://p.jreinert.com/xB9rL/ruby
<BlaXpirit> jokke, why do you use mutex?
rmosolgo has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 1 new commit to master: https://git.io/v2fEr
<crystal-gh> crystal/master 6be7929 Ary Borenszweig: Fixed #2185: Flags enum doesn't get attributes and docs correctly attached
<jokke> BlaXpirit: i also tried with Channel
<jokke> BlaXpirit: still deadlocks
<jokke> fyi i use the Cache in a benchmark
<jokke> so i guess it might be used in multiple subprocesses
<jokke> or subprocedure?
<travis-ci> manastech/crystal#6be7929 (master - Fixed #2185: Flags enum doesn't get attributes and docs correctly attached): The build passed. https://travis-ci.org/manastech/crystal/builds/110387764
<DeBot> https://github.com/manastech/crystal/issues/2185 (Flags with underlying UInt8 to_s number instead of list)
rmosolgo has quit []
Philpax has quit [Ping timeout: 250 seconds]
<BlaXpirit> jokke, i don't see any asynchronous code, just mutex
<jokke> yeah the whole thing is bigger. Basically i call the setup_with_size method and then other code calls fetch on the instance
<jokke> but the only part where i'm knowingly doing something parallel is in line 68 with the spawn
<jokke> BlaXpirit: you can take a look at the code here: https://github.com/jreinert/crystal-jsonapi
<jokke> the only thing different is the implementation of the Cache which i pasted
<jokke> the benchmark code is in examples/benchmark.cr
<sdogruyol> did you try removing that mutex?
<jokke> sdogruyol: yeah, then the cache allocates so much memory that the process get's killed
<jokke> i think it's because cleanup isn't finished before the next fetch (and cache miss) comes in
<jokke> at least that's the only explanation i can think of
<jokke> so that would mean there are parallel fetches
<jokke> which probably come from the Benchmark.ios
<jokke> *ips
<jokke> BlaXpirit: also, shouldn't using mutex#synchronize be okay even in single threaded code? Shouldn't make any difference
<jokke> Since neither of the synchronized blocks call anything that would result in the Mutex lock being aquired i'm confused why this should deadlock
irclogger_______ has quit [Read error: Connection reset by peer]
Renich has joined #crystal-lang
waj has quit [Quit: ZNC 1.6.1 - http://znc.in]
<jokke> ah
<jokke> now i get it
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
waj has joined #crystal-lang
nnil has joined #crystal-lang
<crystal-gh> [crystal] asterite pushed 2 new commits to master: https://git.io/v2JeX
<crystal-gh> crystal/master a6371c3 Marcelo Boeira: Spec: Make it possible to use multiple formatters...
<crystal-gh> crystal/master a3edd6b Ary Borenszweig: Merge pull request #2153 from marceloboeira/multiple-formatters...
<travis-ci> manastech/crystal#a3edd6b (master - Merge pull request #2153 from marceloboeira/multiple-formatters): The build has errored. https://travis-ci.org/manastech/crystal/builds/110420708
<DeBot> https://github.com/manastech/crystal/pull/2153 (Spec: Make it possible to use multiple formatters)
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<travis-ci> manastech/crystal#a3edd6b (master - Merge pull request #2153 from marceloboeira/multiple-formatters): The build passed. https://travis-ci.org/manastech/crystal/builds/110420708
<DeBot> https://github.com/manastech/crystal/pull/2153 (Spec: Make it possible to use multiple formatters)
r00takaspin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<[spoiler]> what's up with my wee little pull requests for range/enum additions
r00takaspin has joined #crystal-lang
nnil has quit [Ping timeout: 250 seconds]
djanatyn is now known as jesus_number_thr
jesus_number_thr is now known as Jesus3
RX14 has quit [Quit: Fuck this shit, I'm out!]
RX14 has joined #crystal-lang
Jesus3 is now known as Beyonce73
BlaXpirit has quit [*.net *.split]
wmoxam has quit [*.net *.split]
grindhold has quit [*.net *.split]
endou has quit [*.net *.split]
Beyonce73 has quit [*.net *.split]
endou has joined #crystal-lang
wmoxam has joined #crystal-lang
Beyonce73 has joined #crystal-lang
BlaXpirit has joined #crystal-lang
grindhold has joined #crystal-lang
robacarp has quit [*.net *.split]
matp has quit [*.net *.split]
acetoxy has quit [*.net *.split]
Dreamer3 has quit [*.net *.split]
Liothen has quit [*.net *.split]
dom96 has quit [*.net *.split]
braidn has quit [*.net *.split]
Liothen has joined #crystal-lang
matp has joined #crystal-lang
g3funk has joined #crystal-lang
Dreamer3 has joined #crystal-lang
Beyonce73 has quit [Client Quit]
acetoxy has joined #crystal-lang
robacarp has joined #crystal-lang
djanatyn has joined #crystal-lang
djanatyn is now known as Beyonce74
Beyonce74 is now known as Beyonce75
dom96 has joined #crystal-lang
elia has quit [Quit: Computer has gone to sleep.]
pawnbox has quit [Remote host closed the connection]
r00takaspin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Renich has quit [Ping timeout: 240 seconds]
Renich has joined #crystal-lang
Renich has quit [Client Quit]
pawnbox has joined #crystal-lang
Beyonce75 is now known as djanatyn
pawnbox has quit [Ping timeout: 255 seconds]
r00takaspin has joined #crystal-lang
r00takaspin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
r00takaspin has joined #crystal-lang
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
r00takaspin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Liothen has joined #crystal-lang
Liothen has quit [Changing host]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 240 seconds]
elia has joined #crystal-lang
djanatyn is now known as i_hate_breasts
g3funk is now known as braidn
i_hate_breasts is now known as djanatyn
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
r00takaspin has joined #crystal-lang
Excureo has quit [Remote host closed the connection]
Excureo has joined #crystal-lang
triangles has quit [Quit: Leaving]
nnil has joined #crystal-lang
Philpax has joined #crystal-lang
<jokke> sdogruyol: https://p.jreinert.com/Lt4G7J/ \o/
<jokke> but it's really hard to test
<jokke> because it's hard to predict what kind of data there would be in the "real world'
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 276 seconds]
<jokke> lol totally wrong numbers.. had a fix coded 1000 in the calculation
<crystal-gh> [crystal] asterite pushed 3 new commits to master: https://git.io/v2Uuf
<crystal-gh> crystal/master 883d002 Ary Borenszweig: Stats: show heap memory
<crystal-gh> crystal/master 5c412ae Ary Borenszweig: Merge branch 'master' of github.com:manastech/crystal
<crystal-gh> crystal/master fb999c9 Ary Borenszweig: Improve error message when assigning an incorrect type to an instance variable with a declared ttype
<travis-ci> manastech/crystal#fb999c9 (master - Improve error message when assigning an incorrect type to an instance variable with a declared ttype): The build passed. https://travis-ci.org/manastech/crystal/builds/110507771
r00takaspin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
nnil has quit [Ping timeout: 250 seconds]
pawnbox has quit [Ping timeout: 240 seconds]