Perl 6 - the future is here, just unevenly distributed

IRC log for #moarvm, 2017-08-25

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:17 travis-ci joined #moarvm
00:17 travis-ci MoarVM build failed. Samantha McVey 'Remove old strings.markdown documentation file'
00:17 travis-ci https://travis-ci.org/MoarVM/MoarVM/builds/268167499 https://github.com/MoarVM/MoarVM/compare/c322b96758dc...95f6152deeba
00:17 travis-ci left #moarvm
01:40 MasterDuke timotimo, brrt: i logged the .i64 value of param_op_i when running rukudo's test and spectest, it was always positive. could we use a negative value as a flag?
01:52 ilbot3 joined #moarvm
01:52 Topic for #moarvm is now https://github.com/moarvm/moarvm | IRC logs at  http://irclog.perlgeek.de/moarvm/today
02:35 Geth ¦ MoarVM: 0b364cb850 | (Samantha McVey)++ | src/strings/ops.c
02:35 Geth ¦ MoarVM: Speed up `index` 9x when Haystack is strand, needle is 1 long
02:35 Geth ¦ MoarVM:
02:35 Geth ¦ MoarVM: Use a grapheme iterator when looking for a single grapheme inside of
02:35 Geth ¦ MoarVM: a strand. Large speedup when the Haystack is a strand.
02:35 Geth ¦ MoarVM: review: https://github.com/MoarVM/MoarVM/commit/0b364cb850
02:58 travis-ci joined #moarvm
02:58 travis-ci MoarVM build failed. Samantha McVey 'Speed up `index` 9x when Haystack is strand, needle is 1 long
02:58 travis-ci https://travis-ci.org/MoarVM/MoarVM/builds/268212927 https://github.com/MoarVM/MoarVM/compare/95f6152deeba...0b364cb850b6
02:58 travis-ci left #moarvm
03:01 dogbert11 joined #moarvm
06:45 timotimo samcv: you can try removing indexingoptimized from https://github.com/perl6/nqp/blob/master/src/QRegex/Cursor.nqp#L418 and see how that impacts performance
06:45 timotimo ni many cases we'd probably suffer from having ropes because every access goes through at least two indirection, 1) the strands array, 2) the target string
06:46 timotimo since we don't have full "trees" built out of our ropes we'll not have terrible performance degradation in cases like for example $foo ~= "a" over and over again
06:47 timotimo hm. since we already require $orig to be able to turn into a native string, we could perhaps actually do some things on $orig and some on $target? that could be a bad idea :)
06:53 domidumont joined #moarvm
07:06 domidumont joined #moarvm
07:10 leont joined #moarvm
08:23 AlexDaniel joined #moarvm
08:24 zakharyas joined #moarvm
08:27 robertle joined #moarvm
08:54 zakharyas joined #moarvm
09:31 dogbert11 joined #moarvm
09:47 lizmat joined #moarvm
11:03 AlexDaniel joined #moarvm
11:13 vendethiel joined #moarvm
11:31 lizmat joined #moarvm
11:59 MasterDuke joined #moarvm
12:09 brrt joined #moarvm
12:23 brrt MasterDuke, and also nine and others, i'd advise the following API:
12:23 yoleaux 24 Aug 2017 19:02Z <samcv> brrt: can I get the slides from YAPC-EU?
12:24 brrt MVM_args_get_positional(tc, frame, position, type, &address) -> boolean
12:26 MasterDuke brrt: type is required|optional?
12:26 brrt also 'I'm not seeing how using a negative value as a flag could in anyway be safe
12:26 brrt required
12:27 brrt hehe, no
12:27 brrt type is obj/str/int/num
12:27 brrt it's used for casting
12:27 brrt the caller is responsible for branching or throwing
12:29 brrt what's more, currently we're using a nested switch table. that's not necessary. we can encode the 4x4 option matrix as 4 bits and switch on that
12:29 MasterDuke brrt: so e.g., MVM_args_get_required_pos_int would call MVM_args_get_positional(tc, frame, "int", arg_idx)?
12:29 brrt the quote before the 'I should not have been there :-)
12:29 brrt yeah, actually, MVM_reg_int
12:30 brrt rather than "int"
12:30 brrt but yeah
12:30 brrt that's what i mean
12:30 brrt and there wouldn't have to be a required_get_pos_int intermediate
12:30 MasterDuke just curious, but why wouldn't a negative value be safe as a flag?
12:31 brrt equally curious, where did you want to store it?
12:31 brrt but in general, because i64 values are signed, so a negative value is just allowed
12:32 MasterDuke i didn't mean to store it, to decide which branch in the op to take
12:32 nwc10__ joined #moarvm
12:33 leedo_ joined #moarvm
12:33 harrow joined #moarvm
12:33 MasterDuke https://github.com/MoarVM/MoarVM/pull/660/files#diff-bb3587478c6b68f62c75192b00b05f0fL1018
12:33 Voldenet joined #moarvm
12:33 Voldenet joined #moarvm
12:34 MasterDuke and i'm surprised my patch passed spectest, because i don't see how the jitting i added does that branch
12:36 brrt yeah, that suggests missing tests...
12:37 brrt it would fail if you got an optional argument that's 0
12:38 MasterDuke my patch currently? or using a negative value as a flag for the branch?
12:39 brrt your patch. and using a negative value would fail wherever the optional integer argument would be negative
12:39 brrt or for objects, depending on the place of your heap
12:39 brrt anway, afk&
12:41 MasterDuke doh! for some reason i was thinking that value was an index into an array of the args!
12:42 MasterDuke heh, of course branching on negative would be bad
12:46 zakharyas joined #moarvm
13:19 committable6 joined #moarvm
13:31 geekosaur joined #moarvm
13:49 lizmat joined #moarvm
13:55 benchable6 joined #moarvm
14:17 geekosaur joined #moarvm
14:28 Geth ¦ MoarVM: ef2b21ac5b | (Elizabeth Mattijsen)++ | 2 files
14:28 Geth ¦ MoarVM: Fix spello
14:28 Geth ¦ MoarVM: review: https://github.com/MoarVM/MoarVM/commit/ef2b21ac5b
14:45 lizmat joined #moarvm
14:56 geekosaur joined #moarvm
14:58 AlexDaniel joined #moarvm
15:06 travis-ci joined #moarvm
15:06 travis-ci MoarVM build failed. Elizabeth Mattijsen 'Fix spello'
15:06 travis-ci https://travis-ci.org/MoarVM/MoarVM/builds/268388674 https://github.com/MoarVM/MoarVM/compare/0b364cb850b6...ef2b21ac5b58
15:06 travis-ci left #moarvm
15:18 Geth ¦ MoarVM/jit_nativecall: a8698530ed | (Stefan Seifert)++ | src/core/nativecall.c
15:18 Geth ¦ MoarVM/jit_nativecall: Extend JITing native calls to all integerial return types
15:18 Geth ¦ MoarVM/jit_nativecall: review: https://github.com/MoarVM/MoarVM/commit/a8698530ed
15:44 dogbert11 joined #moarvm
15:44 nine Creating complex JIT graphs manually gets tedious really fast. Maybe I need some help...something like a JIT graph builder...
15:55 robertle joined #moarvm
15:55 timotimo switch on over to even-moar-jit, see how you like that
17:19 domidumont joined #moarvm
17:59 leont joined #moarvm
18:09 AlexDani` joined #moarvm
20:12 samcv good (*
20:13 samcv timotimo, so what are the most time consuming calls we usually make. that the regex engine does. so there's index. and i have a branch that makes that 2.5x faster indexing a haystack made up of strands
20:13 samcv which could be a game changer regarding having to flatten the strings
20:15 robertle you are probably aware of that, but there is something weird with regex performance: I have a piece of code at work that reads logfiles, looks for certain lines with a regex, and then does some more
20:16 robertle this is really slow, but when I provide a fastpath by doing $line.contains('something') && $line ~~ /'something' <some_more_complex_stuff/, it gets twice as fast
20:17 robertle but isn't that the first thing the retgex engine does? to use index() or so to find an appropriate anchor from where to start?
20:17 robertle one would expect that "optimisation" to make little difference...
20:18 robertle and this isn't a micro-optimisation thing, it goes from 10 minutes to 4. and according to --profile pretty much all the time is spent in regex code
20:19 robertle ...not really a moar thing of course
20:20 samcv robertle, i think maybe you're seeing what i have been?
20:20 samcv i mean the index operation is very fast. as i continue speeding it up more and more
20:21 samcv but some other stuff takes a while. *especially* if the needle is a variable and not written in directly
20:21 robertle is contains() just sugar over index(), or is it a separate thing
20:21 MasterDuke timotimo has a comment here about things that could be done https://www.reddit.com/r/perl6/comments/5naomy/where_can_i_start_looking_to_speed_up_regular/
20:21 samcv m:  use nqp; nqp::index('h' x 100000000 ~ 'i', 'i', 0); say now - INIT now
20:21 camelia rakudo-moar d0a5cf: OUTPUT: «1.4560151?»
20:21 samcv m:  ('h' x 100000000 ~ 'i') ~~ /i/; say now - INIT now
20:21 camelia rakudo-moar d0a5cf: OUTPUT: «0.365415?»
20:22 samcv m:  use nqp; nqp::index('h' x 100000000 ~ 'i', 'i', 0); say now - INIT now
20:22 camelia rakudo-moar d0a5cf: OUTPUT: «1.7562766?»
20:22 samcv hmm that must be cause it's flattening it, not sure
20:22 samcv m: my $b = 'i';  ('h' x 100000000 ~ 'i') ~~ /$b/; say now - INIT now
20:22 samcv anyway my point is that if the regex takes from a variable it's a ridiculous amount of time slower
20:23 camelia rakudo-moar d0a5cf: OUTPUT: «(timeout)»
20:23 samcv not sure if you've been seeing that
20:24 robertle timotimo's comments are certainly spot on to what I am seeing, I guess there are also a lot of regexes that use "^" or so...
20:24 MasterDuke samcv: one problem might be that the INTERPOLATE routine is not jitted in the /$foo/ case. i've been trying to figure out how to jit the ops that cause it to bail. that's what https://github.com/MoarVM/MoarVM/pull/660 is an attempt at, but it's incorrect
20:24 samcv i mean it probably can't account for 150x speed reduction can it
20:24 MasterDuke and i've been chatting with timotimo and brrt about it
20:25 samcv ah nice
20:25 MasterDuke probably not that much, no
20:25 samcv and also i need help figuring out how to get ignorecase/ignoremark working when there's INTERPOLATE
20:25 MasterDuke but it's 15% in a profile
20:25 samcv cause curretly they don't fully work except for literal
20:26 samcv JITing or INTERPOLATE
20:27 MasterDuke INTERPOLATE is 15% and not jitted
20:28 MasterDuke for this: `my @l = "s.sql".IO.lines; my $p = "Perl6"; my @m = @l.grep(/ $p /); say @m.elems`, where s.sql has 10k lines
20:47 lizmat joined #moarvm
21:12 samcv this is odd. i'm getting 20% faster for strands than for non-strand haystack
21:13 samcv that's very interesting
21:14 timotimo samcv: i'm still convinced matching regexes against strandy strings like a thousand h characters is too far away from real world use cases
21:14 samcv since the code i have, if it's not a strand, it doesn't cache the values
21:14 samcv https://github.com/samcv/MoarVM/blob/c449c87f13fe9c9c0c58d0e4779e8c15e2335315/src/strings/ops.c#L234-L236
21:14 samcv timotimo, well i'm testing against actual books rn
21:14 timotimo how do you make strands from books? :)
21:14 samcv and getting 1.2s for a collapsed string and getting 1.0 second after i concat a space at the end
21:14 samcv just concat a single character at the end
21:15 samcv see what i linked
21:15 samcv if it's not a strand my gi_cached_get_grapheme just refers to MVM_string_get_grapheme_at_nocheck which does a raw access
21:15 samcv to the blob. but somehow it seems to be faster to cache the last grapheme?
21:15 samcv maybe cause cpu cache or how it generates code? idk
21:16 samcv 1 second vs 1.2 when it was flattened. and it should be slower if it's a strand. so let me try having all strings do the same thing, and cache the last grapheme
21:16 samcv this is not what i expected
21:16 samcv (plus it's faster even though i have some debugging code in there to keep track of cache hits/misses)
21:18 samcv timotimo, yep it's now the same speed for a strand and for a non-strand which is interesting. turns out caching the last grapheme really does give a 20% boost
21:26 timotimo huh, ok
21:27 samcv yeah i didn't think that would happen...
21:28 samcv but the timings don't lie. i tested on a book broken into 20 strands, and the timing is close as for after i do indexingoptimized
21:28 samcv raw after slurp 0.83409575
21:28 samcv after concat: 0.86951226
21:28 samcv after indexing opt: 0.8611777
21:35 AlexDani` joined #moarvm
21:55 lizmat joined #moarvm

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary