jhass changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.7.7 | 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
shadeslayer has quit [Remote host closed the connection]
shadeslayer has joined #crystal-lang
kyrylo has quit [Quit: Konversation terminated!]
kyrylo has joined #crystal-lang
shama has quit [Quit: (╯°□°)╯︵ɐɯɐɥs]
qard_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
kyrylo has quit [Ping timeout: 268 seconds]
waj has joined #crystal-lang
Neverdie has quit [Quit: http://radiux.io/]
Neverdie has joined #crystal-lang
havenwood has joined #crystal-lang
fowlduck has quit [Remote host closed the connection]
havenwood has quit [Quit: Textual IRC Client: www.textualapp.com]
DJZ has quit [Quit: Leaving]
waj has quit [Remote host closed the connection]
Neverdie has quit [Quit: http://radiux.io/]
waj has joined #crystal-lang
Neverdie has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
waj_ has quit [Remote host closed the connection]
ssvb has quit [Ping timeout: 264 seconds]
kulelu88 has quit [Quit: Leaving]
waj has joined #crystal-lang
waj has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
waj_ has quit [Read error: Connection reset by peer]
waj has joined #crystal-lang
<crystal-gh> [crystal] technorama opened pull request #1452: Allow comparison between different Iterable types. (master...f/slice_compare) http://git.io/vZVZf
waj has quit [Remote host closed the connection]
Ven has joined #crystal-lang
lokulin has joined #crystal-lang
lokulin has quit [Changing host]
BlaXpirit has joined #crystal-lang
<BlaXpirit> can't seem to remember how to do .each { |x| obj.meth(x) }
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<BlaXpirit> .each &->obj.meth(T)
<BlaXpirit> which isn't better
<willl> asterite: sorry I haven't used cgo
Neverdie has quit [Quit: http://radiux.io/]
kyrylo has joined #crystal-lang
<buggs> is there an mmap interface?
<jhass> buggs: no highlevel one I'm aware of, Crystal is a GC'ed language after all, the stance is that in highlevel code you shouldn't care about memory management (too much)
<jhass> however you do can just call LibC.mmap
<buggs> it's more a replacement for seek
leafybasil has quit [Remote host closed the connection]
Ven has joined #crystal-lang
leafybasil has joined #crystal-lang
leafybasil has quit [Ping timeout: 272 seconds]
leafybasil has joined #crystal-lang
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fowlduck has joined #crystal-lang
<dzv> an mmap that gives you Slices could be useful. m = Mmap("file"); slice = m[offset, len]
<jhass> more like File.mmap I guess
fowlduck has quit [Ping timeout: 260 seconds]
sardaukar has joined #crystal-lang
sardaukar has quit [Ping timeout: 256 seconds]
sardaukar has joined #crystal-lang
<crystal-gh> [crystal] jhass pushed 3 new commits to master: http://git.io/vZwfR
<crystal-gh> crystal/master 01054e1 Nakilon: fixed taking negative count from empty Array
<crystal-gh> crystal/master 1563c43 Nakilon: added more Array#[] tests
<crystal-gh> crystal/master 9f3b57f Jonne Haß: Merge pull request #1450 from Nakilon/fixed_slice...
<travis-ci> manastech/crystal#9f3b57f (master - Merge pull request #1450 from Nakilon/fixed_slice): The build has errored. https://travis-ci.org/manastech/crystal/builds/79980529
sardaukar has quit [Quit: ZNC - http://znc.in]
sardaukar has joined #crystal-lang
<jokke> hello
<jokke> how would i iterate over a Uint8**
ssvb has joined #crystal-lang
<BlaXpirit> jokke, that could be anything
<jokke> hm?
<jokke> i know it's an array of strings
sardaukar has quit [Ping timeout: 256 seconds]
dyulax has joined #crystal-lang
<dzv> this is from a c library? or you have the data already in a crystal type?
<BlaXpirit> jokke, well u can to_slice(n)
<jokke> dzv: c lib
<BlaXpirit> then each item is UInt8* which can be turned into String.new(that)
<jokke> yes
<BlaXpirit> also: use LibC::Char to make the intent clearer
<jokke> oh i thought i could just do pointers[i]
<BlaXpirit> jokke, u can
<BlaXpirit> (i think)
<BlaXpirit> but u asked about iteration, and turning it into slice is what makes actual iteration possible
<jokke> i see
<dzv> do you already have a reference in a Pointer object? if so, String.new(pointer) if it's a null terminated string
waj has joined #crystal-lang
apt-get has joined #crystal-lang
sardaukar has joined #crystal-lang
<jokke> i get an error expecting token ')', not ',' in line 5
<jokke> any clues?
<jokke> of course the result = .. is unnecessary
<jokke> also i'm not sure if i should use @ or @@ here
<dzv> i'm not sure where StaticArray will be stored. it's normally on the stack
<jokke> i think @ since it's already a class method
<jokke> hm ok
<dzv> maybe it's copied...
<jokke> i could use to_slice(lang_count) and then map over it
<jokke> but that would realloc lang_count times, right?
<jokke> or is map smart and allocs once length * sizeof T
<jokke> ?
<dzv> change to: result = Array(String).new(5) do |i|
waj has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
<dzv> i think you are over optimizing a one time allocation
<jokke> i guess so
<jokke> hmm
<jokke> can't cast UInt32 to Int32
<jokke> get_available_languages gives back a UInt32
<dzv> Int32.cast(num)
<jokke> oh
<jokke> ok
ssvb has quit [Ping timeout: 240 seconds]
<BlaXpirit> >> 5u.to_i
<DeBot> BlaXpirit: Syntax error in eval:4: invalid uint suffix - http://carc.in/#/r/ezl
<BlaXpirit> >> 5u32.to_i
<DeBot> BlaXpirit: # => 5 - http://carc.in/#/r/ezm
<jokke> oh
<jokke> ok
<jokke> that's more elegant of course
<trapped> code has not changed for a while
<jhass> trapped: great so another compiler bug. Please try to reduce it and open an issue
<trapped> i would if i knew where that was coming from
<jhass> I know neither
<trapped> i'll try and look into it later
<jhass> just try to remove portions of code to triage it
<jhass> remove codepath -> reproduce -> (readd codepath) -> back to start
<trapped> i'll probably try to have the compiler print whatever it was trying to compile that made it crash
kyrylo has quit [Ping timeout: 260 seconds]
ssvb has joined #crystal-lang
dyulax has quit [Quit: This computer has gone to sleep]
apt-get has quit [Ping timeout: 252 seconds]
<crystal-gh> [crystal] jhass opened pull request #1456: Extract build scripts into a shellscript (master...travis_extract) http://git.io/vZwDU
kyrylo has joined #crystal-lang
apt-get has joined #crystal-lang
<waj_> whoa! jhass you just fixed the build. Merge that immediately! :-)
waj_ is now known as waj
<jhass> sure, feel free to press the button ;)
<waj> Done, thanks!
<crystal-gh> [crystal] waj closed pull request #1456: Extract build scripts into a shellscript (master...travis_extract) http://git.io/vZwDU
<waj> I also really like the script refactor
<crystal-gh> [crystal] waj pushed 1 new commit to master: http://git.io/vZwHd
<crystal-gh> crystal/master 1a26f7a Juan Wajnerman: Set debug locations for nodes: `if`, `while`, `next` and `break`
<jhass> thanks, I'm getting too good at shell script -.-
<waj> my best skill in shell scripting is copy/paste :P
<BlaXpirit> good. it's the most important one.
<jhass> not saying I truly understand half of the techniques used there ...
<travis-ci> manastech/crystal#5c17c3f (master - Merge pull request #1456 from jhass/travis_extract): The build failed. https://travis-ci.org/manastech/crystal/builds/79994215
<jhass> meh, the BCrypt fluke again
<travis-ci> manastech/crystal#1a26f7a (master - Set debug locations for nodes: `if`, `while`, `next` and `break`): The build passed. https://travis-ci.org/manastech/crystal/builds/79994296
<jhass> someone™ should really do something about that :P
Neverdie has joined #crystal-lang
dylanmei has joined #crystal-lang
dyulax has joined #crystal-lang
havenwood has joined #crystal-lang
elia has joined #crystal-lang
<waj> jhass: lldb seems to work fine only if no `debugger` is used
<waj> that means, use `breakpoint set ...`
<waj> I found gdb better anyway
<waj> lldb doesn't allow to step over inlined functions
<jhass> it's kind weird though, no?
<waj> yes, because it works fine in mac
<waj> but just saying, if you want to use it in linux
<waj> brb
waj has quit [Remote host closed the connection]
elia has quit [Quit: Computer has gone to sleep.]
kulelu88 has joined #crystal-lang
<kulelu88> Does Crystal have support for an async API?
<BlaXpirit> ...
<kulelu88> Basically, I need Crystal to process data from a DB and then feed it into an Angular app
<jhass> kulelu88: blocking IO operations will suspend the current fiber and schedule another one that's not longer blocked
<jhass> the default http server spawns a new fiber per incoming request
<kulelu88> jhass: is there a nice tutorial on how to do this?
<jhass> it should happen implicitly
<kulelu88> oh, the default http server has async built-in?
<jhass> as said it spawns a new fiber per request
<kulelu88> jhass: and will I be able to build an RESTful API on top of it?
<jhass> sure
<kulelu88> jhass: for real-time data, would I be better of using Redis?
<jhass> tbh I start to wonder if you just throw buzzwords around ...
<kulelu88> jhass: fair point, but I am looking to eliminate IO bottlenecks. The data needs to move in and out fast enough for real-time output
<jhass> build a PoC and try?
jsaak has joined #crystal-lang
<jsaak> hello, i am toying with crystal, and i am looking for some kind of marshaling, but did not find anything
<jsaak> i need something memory efficient
dylanmei has quit [Quit: bang. gone.]
Neverdie has quit [Quit: http://radiux.io/]
<jsaak> thanks! so i have to wait for it to be finsihed, or finish it myself, right?
<jsaak> and btw jhass thank you for your answers, today it is the third already
<jhass> yes, a custom implementation might be faster/easier for now
<jhass> yw
apt-get_ has joined #crystal-lang
apt-get has quit [Ping timeout: 246 seconds]
jeromegn has joined #crystal-lang
apt-get_ is now known as apt-get
Neverdie has joined #crystal-lang
nakilon has quit [Ping timeout: 246 seconds]
waj has joined #crystal-lang
waj has quit [Ping timeout: 246 seconds]
dyulax93 has joined #crystal-lang
dyulax has quit [Ping timeout: 240 seconds]
tomchapin has joined #crystal-lang
<jokke> i'm experiencing a weird error caused by the highlighted line: https://p.jreinert.com/m-ALr/#n-5P00gN-14
<jokke> this is my Xapian::Query class: https://p.jreinert.com/0gJFus/ruby
<jhass> that's probably a compiler bug, but try nuking your .crystal directory
<jokke> alright
<jokke> nope
<jokke> no change
<jhass> would be great if you can push the runnable thing to a repo on github and open an issue
<jokke> ok
<jhass> jokke: mmh, btw why do you go through the glib binding instead of libxapian directly?
waj has joined #crystal-lang
havenwood has quit [Ping timeout: 264 seconds]
<crystal-gh> [crystal] will closed pull request #1401: Add Block Comment Syntax (master...block-comments) http://git.io/vZUS4
trapped has quit [Read error: Connection reset by peer]
trapped has joined #crystal-lang
waj has quit [Remote host closed the connection]
waj has joined #crystal-lang
waj has quit [Ping timeout: 265 seconds]
<jeromegn> I forgot all my Crystal. Haven't done it in a long time... how do I convert a byte to its string representation? like: 119 => "w"
<jokke> jeromegn: libxapian is c++
<jokke> jhass: ^
<jhass> ah, mh
<jhass> jeromegn: .ord, returns that returns a Char, to_s if you really need the string
<jeromegn> thanks!
<jhass> s/returns//
<jokke> what's the situation with https://github.com/manastech/crystal/pull/1416 btw
<jhass> oh, didn't even notice you fixed the specs, sorry -.-
<jokke> np
<jhass> but given the underscores are valid, I wonder if we can keep them for the serialization, but translate on comparison
waj has joined #crystal-lang
trapped has quit [Read error: Connection reset by peer]
leafybasil has quit [Remote host closed the connection]
leafybasil has joined #crystal-lang
<BlaXpirit> jhass, jeromegn, wasn't that supposed to be .chr
<BlaXpirit> >> 119.chr
<DeBot> BlaXpirit: # => 'w' - http://carc.in/#/r/f04
<jhass> eh, right
<jhass> somehow I always mix them up
<BlaXpirit> chr gets char, ord gets ordinal :p
<jhass> I guess it's that I never use ordinal and rather say codepoint
leafybasil has quit [Ping timeout: 250 seconds]
<jeromegn> :)
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jeromegn> so, I'm implementing the BSON spec in Crystal. it's simple enough, it's a nice practice. I'm inspiring a lot from the ruby implementation (https://github.com/mongodb/bson-ruby)
<jeromegn> the way that they represent an ObjectId as a string is using unpack
<jeromegn> unpack("H*")[0]
<jeromegn> to get the hexadecimal string
<jeromegn> I basically have a Slice(UInt8) with 12 bytes in there
<jeromegn> I tried Slice#hexstring but that didn't match what MongoDB showed me
<jeromegn> I'm not sure how to replicate the behaviour of unpack with Crystal. thoughts?
<jeromegn> I guess I want to show each byte as a hex string
<jeromegn> and then join them
<jeromegn> hmm
<jeromegn> exmaple bytes: [173, 19, 162, 106, 103, 110, 77, 224, 0, 0, 0, 2]
<jeromegn> as a hex string, it should return "55ad13a26a676e4de0000000"
<BlaXpirit> jeromegn, i don't see any paralels there
<jeromegn> between the bytes and the resulting string?
<BlaXpirit> u understand that there is a 2 in the end, but in the result u only have 0s
<jeromegn> yes
<BlaXpirit> so...?
<jeromegn> I do understand what you're saying, and I'm pretty sure that the key is the way those bytes are unpacked in the ruby bson lib
<BlaXpirit> jeromegn, so point me to relevant information
<jeromegn> I'm trying to be thorough when asking questions here :) but it's not always relevant, I don't know what's relevant for this at this point.
<BlaXpirit> i can't see it
<jeromegn> this node.js implementation is interesting: https://github.com/marcello3d/node-buffalo/blob/master/lib/objectid.js#L93
<jeromegn> I have no idea if it's correct though
<BlaXpirit> jeromegn, ruby says "\x00\x01\x02\xff".unpack("H*") == ["000102ff"]
<BlaXpirit> >> "\x00\x01\x02\xff".hexstring
<DeBot> BlaXpirit: Error in line 4: undefined method 'hexstring' for String - http://carc.in/#/r/f0b
<BlaXpirit> >> "\x00\x01\x02\xff".to_slice.hexstring
<DeBot> BlaXpirit: # => "783030783031783032786666" - http://carc.in/#/r/f0c
<BlaXpirit> uhhhhhh
Neverdie has quit [Quit: http://radiux.io/]
<BlaXpirit> >> [0u8,1u8,2u8,255u8].to_unsafe.to_slice(4).hexstring
<DeBot> BlaXpirit: # => "000102ff" - http://carc.in/#/r/f0d
<BlaXpirit> whatever
<jeromegn> that seems more correct
<BlaXpirit> what's the problem, jeromegn? where did u get that example?
<BlaXpirit> when you said "it should return"
<jeromegn> the data? I dumped one of my records to a bson file
<BlaXpirit> yeah, that node implementation is just lame javascript that does the same thing
<waj> \xNN is not supported in crystal strings
<jeromegn> and when I query it with the mongo shell, it outputs that "_id" : ObjectId("55ad13a26a676e4de0000000")
<BlaXpirit> waj, why not? maybe you mean it's supported in a different way?
<waj> strings are meant to be always valid utf8 in memory
<jhass> mmh, we should support StaticArray { a, b, c } and Slice { a, b, c }
<BlaXpirit> doh
<waj> for binary constructions, use Slice(UInt8)
<BlaXpirit> "\u0097\U00000097"
<BlaXpirit> >> "\u0097\U00000097"
<DeBot> BlaXpirit: # => "\u{97}U00000097" - http://carc.in/#/r/f0e
<BlaXpirit> >> "\u{97}\u{1103}"
<DeBot> BlaXpirit: # => "\u{97}ᄃ" - http://carc.in/#/r/f0f
<BlaXpirit> >> "\u{61}\u{44f}"
<DeBot> BlaXpirit: # => "aя" - http://carc.in/#/r/f0g
<BlaXpirit> ok ok, that makes more sense
<BlaXpirit> python just does this so: \xff is the same as \u00ff is the same as \U000000ff
<waj> jhass: sure! dunno if that syntax but we need literals for slices
<BlaXpirit> and we surely need array.to_slice :|
<jhass> well it's already there, just needs the matching constructor, would be a cheap thing for now I think
<BlaXpirit> anyhow, jeromegn, there is some misunderstanding here. hexstring works well, i just don't know these BSON concepts
<jhass> >> "55ad13a26a676e4de0000000".chars.each_slice(2).map {|b| b.join.to_i(16) }.to_a
<DeBot> jhass: # => [85, 173, 19, 162, 106, 103, 110, 77, 224, 0, 0, 0] - http://carc.in/#/r/f0h
<jhass> yeah, no idea how you arrived at that byte sequence
<jeromegn> oh you know what
<jeromegn> I might have been off by one byte
<jhass> hah, indeed
<BlaXpirit> :D
<jeromegn> dangit
<jeromegn> :
<jeromegn> :)
<jeromegn> alright that does work
waj has quit [Read error: Connection reset by peer]
waj_ has joined #crystal-lang
elia has joined #crystal-lang
waj_ is now known as waj
<dzv> has anyone considered adopting the actor model in crystal?
Neverdie has joined #crystal-lang
<waj> what do you mean by adpoting? I'd love to see an actor model implemented in Crystal
<dzv> adopting over DIY channels and spawn. actors seem like a more organized way to handle may tasks
<dzv> s/may/many
<jeromegn> is there a better way to cast bytes as various types? for instance, a Int32, given a Slice(UInt8) named "bytes":
<jeromegn> b1, b2, b3, b4 = bytes; tuples32 = {b1, b2, b3, b4}; (pointerof(tuples32) as Int32*).value
<waj> dzv: can't we just have actors implemented on top of that, like in erlang?
<waj> jeromegn: aren't you concerned about endianness there?
<BlaXpirit> jeromegn, this is indeed the main way to do it. note that this is not a good way, because it depends on processor endianness
<jeromegn> well, I'm sort of concerned
<jeromegn> :)
<jeromegn> what other way is there?
<BlaXpirit> jeromegn, bit manipulations
<BlaXpirit> b1 << 24 & b2 << 16 & b3 << 8 & b4
<BlaXpirit> (reverse order if opposite endianness is desired)
<jeromegn> thanks
<BlaXpirit> jeromegn, also please use parentheses because these << have weird precedence. i think i made a mistake and it must be (b1 << 24) & (b2 << 16) etc
<jeromegn> appreciated!
BlaXpirit has quit [Quit: Konversation]
<jokke> jhass: honestly i didn't know about the option to pass a comperator to Hash.new
<jhass> I always forget it too ;)
<jokke> see my comment to the PR. I'd be interested in the benchmark
<jhass> jokke: http://paste.mrzyx.de/pkoxg6vwt let's see
<jokke> just add a next if cstr1[i] == cstr2[i] before line 21
<dzv> waj: absolutely probably
<jokke> when is the hash(key) method used?
<jokke> on every access?
<jhass> yes
<jhass> the hash is used to determine the bucket
<jokke> yeah
<jokke> and when is equals? used?
<jhass> the bucket is determined by hash % buckets, each bucked is a linked list
<jhass> the item from the list is picked by equals? candidate, key
<jokke> ah i see
<jokke> ok
<jhass> yeah okay, good one I guess, that bumps Fetch Content-Type from HTTP::Headers { "Content-Type" => "bar" } to ~7.3M
<jokke> nice
<jokke> was 17.22M before right?
<jhass> Fetch Content-Type from HTTP::Headers { "Content-Type" => "bar" }
<jhass> HeadersMaster 2.5M (±11.76%) 6.68× slower
<jhass> HeadersPR 16.73M (± 4.33%) fastest
<jhass> HeadersCompare 7.33M (± 1.68%) 2.28× slower
<jokke> ah yeah that was PR
<jokke> more is better m(
<jokke> but it was 5.3x slower before
<jhass> yeah
<jokke> i guess that's an improvement
<jhass> I mean it's an improvement over master for any case anyway
<jokke> that's true
<jokke> but i like your approach better than mine
<jokke> it's much cleaner with the comperator
<jokke> *comparator
<jokke> and i like the fact, that keys are left alone
<jhass> what it doesn't support is having both Foo-Bar and Foo_Bar, which is technically legal
<jokke> oh
<jokke> hmm
<jhass> but would be weird in practice
<jokke> wel
<jokke> l
<jokke> yeah
Neverdie has quit [Quit: http://radiux.io/]
<jhass> waj: do you know what PartialComparator is about? I don't get the difference to Comparator
apt-get has quit [Ping timeout: 260 seconds]
apt-get has joined #crystal-lang
<waj> mm... no, I don't know
<jhass> eh, I mean Comparable of course
<jokke> jhass: how did you get the k and M suffixes?
<jhass> by using HEAD ;)
<jokke> haha
<jokke> alright
<jokke> installing
<jokke> jhass: i'll try a little trick to speed up normalize_byte a bit
<jhass> sure
<jokke> not sure if it helps but it's fun to try :)
<jokke> the results are more diffable with the suffixes
<jhass> yes, though it's better to relate the times faster values between runs if the difference is 100-200k only
<jokke> sure
<jhass> the standard derivations are quite huge, at least on my machine
<jokke> mmh
<jhass> eh, deviations? my math english still sucks -.-
<jokke> hehe
<jokke> yeah, i feel you. I grew up in finland going to a german school. it was a disaster every time my finnish mom tried to help me with maths :D
<jhass> wow, that's a combo :D
<jokke> yeah :D
<jhass> wth are there german schools in finland ... :P
<jokke> there's one
<jeromegn> hurray
<jeromegn> I'm able to parse some basic BSON :)
<jokke> there's one in pretty much every country. we just had a class reunion and a former teacher came from caracas, venezuela where he's teaching now (at a german school)
waj has quit []
<jokke> yeah my deviations are even worse than yours jhass
<jokke> -+ 15 and such
<jokke> ok with my patch Inserting is fastest with all variants on HeadersCompare
<jokke> damn
<jokke> Content-Type from { "Content-Type" => "bar" } is still 1.14x slower on HeadersCompare
<jokke> but it seems it's helped a lot
<jokke> Fetch Content-Type from HTTP::Headers { "CONTENT-TYPE" => "bar" }
<jokke> is only 1.83x slower now
<jhass> cool
<jokke> i'm just working with probabilities..
elia has quit [Quit: Computer has gone to sleep.]
<jokke> it's most likely that a byte that's between 'a' and 'z' or '-' comes in, which is the cheapest situation
<jokke> so i check that first
<jokke> line 31
apt-get has quit [Remote host closed the connection]
<jokke> not sure if line 37 and 38 are needed anymore
<jokke> i left it for stuff like Foo-Bar3
<jokke> but i'm not sure if that's valid
<jhass> well, we also need to handle malicious input ;)
<jokke> what do you mean?
<jhass> desperately invalid stuff
<jokke> do we? :/
<jhass> sure, it's used in the http server
<jhass> exposed to the wild and so on
kyrylo has quit [Quit: Konversation terminated!]
<jokke> mmh
<jokke> true
<jokke> damn
kyrylo has joined #crystal-lang
<jokke> but what can happen? wouldn't the current state allow all sorts of input
<jhass> mmh, I guess
<jokke> ah you meant we need the else block for those corner cases?
<jhass> dunno, it just feels better to consider also the non-RFC cases explicitly
elia has joined #crystal-lang
<jokke> yeah
<jhass> Fetch Content-Type from HTTP::Headers { "Content-Type" => "bar" }
<jhass> HeadersMaster 2.66M (±12.68%) 6.33× slower
<jhass> HeadersPR 16.85M (± 2.24%) fastest
<jhass> HeadersCompare 13.79M (± 1.73%) 1.22× slower
<jhass> that should be good enough
<jokke> yeah
<jhass> I wonder if that affects the http server throughput already
<jokke> that'd be awesome :)
<jhass> well, doubt a hello world server has more than 4-5 header accesses though
<jokke> yeah.
<jhass> probably just two for the request & response content length + the inserts
<jhass> if even actually
<jokke> mmh
<jokke> jhass: would you like to submit a pull request to my fork, so we can update the main pull request? :)
<jokke> or how should we go about this
<jhass> I think I'll do a commit with my initial version and fake a commit from you with the optimizations and open a new PR :)
<jokke> alright :)
knoopx has joined #crystal-lang
elia has quit [Quit: Computer has gone to sleep.]
<jhass> weird, I tried like https://github.com/manastech/crystal/commit/9bc4228d412bccd7a6d3f8ea8cc2354285ec18b0 to keep the same codestyle, but that seems to be slower oO
<jokke> hmm
<jokke> weird indeed
<jhass> let's try guard style all the way
<jhass> yap, that seems to bring another 200k on insertion alone
<jokke> wow
<jokke> cool
<jokke> but weird
<jokke> did you try --release?
<jhass> I guess LLVM has a harder time optimizing the elsif for some reason
<jhass> I'm using --release all the time
<jokke> yeah
<jokke> ok
<jhass> Fetch Content-Type from HTTP::Headers { "Content-Type" => "bar" }
<jhass> HeadersMaster 2.61M (±17.57%) 6.73× slower
<jhass> HeadersPR 17.59M (± 3.85%) fastest
<jhass> HeadersCompare 17.58M (± 5.99%) 1.00× slower
<jhass> this is so weird
elia has joined #crystal-lang
<jokke> why?
<jhass> I smell a big codegen optimization possibility here
<jhass> I still man the elsif
<jhass> *mean, elsif vs return if
<jokke> is HeadersPR the elseif?
<jhass> no
<jokke> ah ok
<jokke> before it was something like 1.12 right
<jokke> maybe open up an issue and reference to your PR
<jhass> yeah
<jhass> I'll definitely try to find a minimal benchmark demonstrating that
<jokke> yeah
elia has quit [Quit: Computer has gone to sleep.]