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