jrafanie has joined #jruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #jruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sgeorge has joined #jruby
sgeorge has quit [Remote host closed the connection]
Puffball_ has joined #jruby
Puffball has quit [Ping timeout: 240 seconds]
damnski has quit [Ping timeout: 240 seconds]
damnski has joined #jruby
slyphon has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<GitHub151> [jruby] kares pushed 2 new commits to master: https://git.io/fN4cS
<GitHub151> jruby/master 77a768c kares: [refactor] convert bytes to int without regexp
<GitHub151> jruby/master 0b7b181 kares: [refactor] minor warnings - replace char can be used
sgeorge has joined #jruby
sgeorge has quit [Ping timeout: 260 seconds]
<GitHub137> [jruby] kares opened pull request #5259: [refactor] date parse internals to avoid $frame vars (master...date-speed) https://git.io/fN4l0
Caerus has quit [Quit: Leaving]
rdubya has quit [Ping timeout: 276 seconds]
shellac has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
shellac has joined #jruby
drbobbeaty has joined #jruby
drbobbeaty has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<kares> enebo: oh right, seems it has issues - I assumed its a flaky build, since the CI isn't 100% stable
<travis-ci> jruby/jruby-openssl (master:3f25f72 by kares): The build has errored. (https://travis-ci.org/jruby/jruby-openssl/builds/395468396)
<kares> will get it green by reverting or trying newer jruby for Maven - its just that its really hard to get the maven jruby plugin right for the whole matrix ;(
<GitHub47> [jruby-openssl] kares created ci-green (+1 new commit): https://git.io/fN4r0
<GitHub47> jruby-openssl/ci-green 33475eb kares: [build] try using later 1.7 JRuby for maven plugin
jrafanie has joined #jruby
<travis-ci> jruby/jruby-openssl (ci-green:33475eb by kares): The build has errored. (https://travis-ci.org/jruby/jruby-openssl/builds/407541613)
drbobbeaty has joined #jruby
<GitHub171> [jruby-openssl] kares pushed 1 new commit to ci-green: https://git.io/fN46F
<GitHub171> jruby-openssl/ci-green 91c5ad1 kares: [ci] do not use failing to start 1.7 JRubies...
rdubya has joined #jruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rdubya has quit [Ping timeout: 256 seconds]
<travis-ci> jruby/jruby-openssl (ci-green:91c5ad1 by kares): The build passed. (https://travis-ci.org/jruby/jruby-openssl/builds/407555800)
ahorek has joined #jruby
ahorek has quit [Client Quit]
rdubya has joined #jruby
Puffball_ has quit [Read error: Connection reset by peer]
Puffball has joined #jruby
<GitHub18> [jruby-openssl] kares merged ci-green into master: https://git.io/fN4ME
<GitHub127> [jruby-openssl] kares deleted ci-green at 91c5ad1: https://git.io/fN4Mg
<kares> jossl CI should be green now
<travis-ci> jruby/jruby-openssl (master:91c5ad1 by kares): The build passed. (https://travis-ci.org/jruby/jruby-openssl/builds/407574100)
sgeorge has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
shellac has joined #jruby
sgeorge has quit [Remote host closed the connection]
<enebo> kares: coolio
<enebo> kares: I don't know if I commented earlier about another idea for date parsing or not
<enebo> In one of those parse benches I notices it does 7 sub! but the first 4 do not actually sub until it reaches iso date
<enebo> As an experiment I removed those first 4 and we are barely slower than MRI
<enebo> Obviously that is not a solution but it does definitely show sub! is expensive
<enebo> as you noticed based on your latest PR
<enebo> I half wonder how fast we would be once we make match? work quickly to if match? then sub!
<enebo> This may even be compatible with your latest PR too
<enebo> lopex: you look at removing joni machinery for faster match?
Caerus has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
sgeorge has joined #jruby
slyphon has joined #jruby
sgeorge has quit [Read error: Connection reset by peer]
sgeorge_ has joined #jruby
sgeorge_ has quit [Ping timeout: 268 seconds]
sgeorge has joined #jruby
<ChrisBr> enebo: headius: tests look quite good, however, some three suites time out. Did you experience this already? https://travis-ci.org/jruby/jruby/builds/407613595
sgeorge has quit [Remote host closed the connection]
sgeorge has joined #jruby
shellac has joined #jruby
jrafanie has joined #jruby
<enebo> ChrisBr: yeah those test:mri ones look odd
<enebo> ChrisBr: we do sometimes have timeouts but all three of those seem to be in the same spot
<enebo> ChrisBr: can you run test:mri and see if you see that
<enebo> I will try and eliminate some of this red this morning...looks like we added a param to CompiledIRMethod and missed it failing our spec:compiler run
<ChrisBr> enebo: hm ok
<enebo> ChrisBr: it is weird for all three to hang in the same place
<ChrisBr> oh is it the same place?
<enebo> we have spurious tests we should remove but I have never seen 3 runs of test:mri hang in same place in a single run
<enebo> well I think so. The last text all seem to be around some cgi escaping tests
<ChrisBr> locally I can not even start the test :/
<enebo> oh yeah? what happens?
<ChrisBr> nothing
<ChrisBr> is stall after starting mri test suite
<ChrisBr> anyway, already have sth suspicious, maybe some infinite loop in the base iterator
<ChrisBr> need to leave now! Thanks! Cu tomorrow
<GitHub48> [jruby] enebo pushed 1 new commit to master: https://git.io/fNBf3
<GitHub48> jruby/master d7b657b Thomas E. Enebo: Fix spec for removed hasKwargs parameter
<enebo> ChrisBr: ok cya
slyphon has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
shellac has quit [Quit: Computer has gone to sleep.]
shellac has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
slyphon has joined #jruby
shellac has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
shellac has joined #jruby
xardion has quit [Remote host closed the connection]
xardion has joined #jruby
<kares> enebo: yeah - that was my line of thinking (already avoided proper sub! but the replacement isn't that much faster)
<kares> PR is an experiment but there's a few match?-es around now so if that improves parsing improves
<kares> > does 7 sub! but the first 4 do not actually sub until it reaches iso date
<kares> yeah but MRI does those too ... although slightly differently
ahorek has joined #jruby
<kares> we could re-arrange iso to go first :) ... most common those eu/us dates with month abbreviations shouldn't be first
<lopex> enebo: not removing, just guarding
<lopex> we could pass that via options I guess
<kares> oh I see they have some checks before going down the rabbit hole of sub! .. will try it out and report on the PR
<enebo> kares: I wondered about rearranging but I figured they are subsets of iso but not the same (e.g. month and day are swapped)
<enebo> kares: I think match? will be 2-3x faster than sub if joni is not building match data behind the scenes
<enebo> so match? of same regexp before subs would give something back
<enebo> although at this point I keep wondering if we should just go full native as the short term fix
<enebo> lopex: guarding means what? just not saving if something is set?
<lopex> enebo: not creating regions upfront
<enebo> lopex: so not making lots of data for matched regions?
<lopex> joni differs wrt that a bit
<lopex> enebo: but I guess not saving the backrefs will be biggest gain
<lopex> since it's thread local access right ?
<enebo> lopex: kares basically did this for a variant of sub! and it was not a lot faster
<lopex> enebo: regions themselves are tiny, and populating them is cheap too
<lopex> which of course we should get rid of too
<enebo> lopex: so it begs why oni is 3x faster than joni then
<enebo> for match?
<lopex> so it will be region population them
<enebo> yeah I am thinking it must since joni always has done well vs oni
<enebo> but what do I know :P
<lopex> enebo: as I mentioned in the commen they have different impl for calling oni
<enebo> lopex: ah yeah
<enebo> lopex: So we have no option for region so we just make them or something like that?
<lopex> they pass NULL to onig_search there
<lopex> yep
<enebo> lopex: yeah mechanism could just a boolean for us and then not make region
<lopex> yes
<enebo> lopex: unless reusing region per thread somehow made sense :)
<lopex> and for backrefs population
<enebo> lopex: that is a different topic though
<lopex> enebo: we can reuse whole matcher per thread though
<enebo> lopex: so much the better if it makes sense
<enebo> lopex: I realized strftime in applications almost always use the same date strings so I added a runtime cache
<enebo> lopex: it dramatically sped up strftime since it was already compiled
<enebo> lopex: yeah even without viewing this I believe I know what will be said
<enebo> lopex: in Rails we things like date/times end up using the same regexp/date formats per application and not many of them
<lopex> enebo: runtime cache for regexp ?
shellac has quit [Quit: Computer has gone to sleep.]
<enebo> lopex: pre-compile regexps we see more than n times?
<lopex> enebo: or did you reuse the existing cache ?
<enebo> err cache
<enebo> no
<lopex> ok
<enebo> lopex: we have regexp cache then?
<lopex> yes
<enebo> ok good
<lopex> weakref one
<kares> there's already a cache being reused
<lopex> soft rather
<lopex> getRgexpFromCache afaik
<enebo> lopex: If I knew this I forgot about it
<kares> except not for any regexps having modifiers
<enebo> oh
<lopex> enebo: there's three of them
<kares> thus a bunch of in date parsing doesn't get reused
<lopex> for quoted and processed regexps too
<kares> all having //i
<enebo> haha well that sucks for some of those date ones
<enebo> i seems like a reasonable thing to cache though
<kares> haven't checked joni if theres aditional checking - just to caching I have seen in RubyRegexp
<kares> but for this we could pbly just write them in native and re-use
<enebo> so iso8601 is not cached because /ix?
<enebo> That is a big regexp
<enebo> kares: perhaps caching that will get out perf better than MRI
<enebo> kares: I also thought about native benefit of value object in Java vs Ruby Hash
<enebo> for your recent change
<enebo> m[:hour]
<enebo> which made me wonder if we are destined short-term just to go full native on this
<lopex> kares: it's options aware
<lopex> and encoding
<enebo> lopex: so //ix regexp caches?
<lopex> I hope I dont lie to you
<enebo> lopex: hey every day is a new day to me...I won't blame you if you are wrong
<lopex> enebo: it should
<enebo> lopex: ok well that would have been a big find if it isn't
<lopex> enebo: getRegexpFromCache
<enebo> yeah this should be fine unless our impl is broken and joni.options is not returning same stuff
<enebo> pretty trivial for me to test I guess
<kares> so its being cached then? cool!
<kares> oh you're still not sure :)
<lopex> well, if it goes through cache of course
<enebo> well if all regexps go through this method this should be doing it
<enebo> unless it alternates the same regexp with difference encodings or options
<enebo> or we have a bug in the impl
<enebo> A better impl of this would be to encode the options in front or back of bytelist
<enebo> then you can have multiple options of same regexp pattern in the cache
<enebo> I guess you pay the price of adding those bytes to the bytelist during lookup
<enebo> or two param hash
<enebo> anyways also not relevant for this problem
Caerus has quit [Read error: Connection reset by peer]
<kares> which getRegexpFromCache path were you guys looking at?
<kares> I followed a factory from native and it did not have the cache there for anything having options
<kares> although I should revisit closely my assumptions ...
<enebo> kares: ah where does it start calling into regexp?
<enebo> kares: I am so hoping you are right :)
<kares> well I only looked at moving some small ones into native
shellac has joined #jruby
<enebo> I only see RubyRegexp constructor and regexpInitialize call through it
<kares> yep that one
<enebo> they both ask the cache
<enebo> It is interesting to see how much happens before the cache lookup in that method
<kares> ah right I see it now
<kares> missed it - sorry for the confusion
<enebo> kares: np
<kares> yeah - that is pnly why I missed it
<kares> since for the other case the cache lookup was in ctor
<enebo> we need regexpcallsite
<enebo> then it can bootstrap all this shit and just keep the pattern at the site
sgeorge_ has joined #jruby
sgeorge has quit [Read error: Connection reset by peer]
<enebo> lol RegexpObjectSite
<enebo> we seem to have it with indy on but I don't think it elides any of this logic
<enebo> but it saves the regexp so I guess it works
<kares> heh
<kares> RubyRegexp seems to be thread-safe so I might try to keep the same instance around in an internal var
<enebo> kares: you mean native or Ruby?
<enebo> kares: using Joni directly may shave some more overhead off too
<lopex> enebo: but you can ask the cache youreselfe
<kares> native - I do have some smaller ones rewriten
<kares> but for some reason it got way slower - I think there's smt wrong cause it should be around ~ same
<enebo> I see the sun/mon/tue section of your PR
<enebo> kares: HAHAHA I think I have a weird way of doing day_num faster
<enebo> ((sun)|(mon)|(tue)...)
<enebo> if $1 is set then if $4 is set then that is tue
<enebo> not sure if joni will be better than extracting the text then doing caseinsensitivecmp
<kares> enebo: already have that in native :) based on C
<enebo> yeah I mean faster than what you have in native
<kares> yeah MRI is doing exactly that - caseinsensitivecmp
<enebo> or maybe faster
<kares> ah okay - let's have it :)
<enebo> since you will be average 3.5 nil checks
<enebo> /((sun)|(mon)|(tue)....)/i will match $1 for day match then you look from $2-$8 for which day is set
<enebo> only unknown is region setup slower or faster
<enebo> It very well may be way slower
<enebo> I just wondered since it would be not searching again and doing case insensitive compare
Caerus has joined #jruby
<enebo> a hashmap may also work out better since bytelist caches its hash calc
sgeorge_ has quit [Remote host closed the connection]
<enebo> kares: with regards to being slower if you are using compile.invokedynamic at all the bytecode is pretty much storing the completely processed regexp into a field so some processing would go away
<enebo> kares: although if you do as you said above and stick it into a field you should see if that overhead matters
Caerus has quit [Read error: Connection reset by peer]
<kares> ok will do some testing on that
<kares> wonder what are those bytes.getClass()/str.getClass() lines around RubyRegexp for
<kares> let's look at git history ...
sgeorge has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
shellac has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
<enebo> lopex: regexp.numMem seems to be main value which defines whether to set up Regions
<enebo> lopex: If somehow we could config it to 0 would all regexps continue to work for match? (e.g. is not doing any captures for $~)
<lopex> but we need a separate flag
<enebo> lopex: why is that?
<lopex> we cant change nummem
<lopex> it's a property of a parsed regexp
<enebo> so all places which makes regions from that value will need to also check a second property?
<lopex> and regexp still needs to use it's groups so that (.)\1 works
<enebo> then we won't make the regions but all will still work
<lopex> yes, that's how mri does it
<enebo> ok
<lopex> why I said we could use options for that
<lopex> *thats
<enebo> yeah I know you said that but I looked at the code now a little bit
<enebo> Option.DONT_CAPTURE_GROUP
<enebo> lopex: what is that?
<enebo> if ((option & (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP))
<enebo> == (ONIG_OPTION_DONT_CAPTURE_GROUP|ONIG_OPTION_CAPTURE_GROUP)) {
<enebo> looks like oni uses slightly different names now
<enebo> oh actually it is same name
<lopex> it's only used during parse
<enebo> lopex: yeah so largely we need msaRegion in our code to not alloc a structure so it will always be null
<enebo> lopex: and an option to do that I guess
<enebo> if (region != null) {
<enebo> this.msaRegion = regex.numMem == 0 ? null : new Region(regex.numMem + 1);
<lopex> and this has to be done at matcher construction
<enebo> so I guess somehow something here which looks at option which we can get from regexp?
<enebo> hmm yeah I don't see Option in Regexp
<lopex> yeah, anyways that's my first idea, I tried to come up with comething better
<enebo> oh options is there
<lopex> yes
<lopex> and not in regexp
<lopex> in a matcher
<lopex> there's two kinds of options
<lopex> regexp and match
<enebo> so I think we just make a new Option (give a name) and we just ask regexp.options & whatever in Matcher constructor
<lopex> but I dont like it for some reason
<enebo> Are all Option.* from regexp?
<lopex> they're mixed
<enebo> or are some for matcher
<enebo> ok
<lopex> they overlap even somewhere afaik
<enebo> I think for sake of experimentation it would be pretty simple but I guess I need to see how Matcher is made
<lopex> vie matcher factory
<enebo> Regexp.matcher
<enebo> but it passed no options
<lopex> enebo: it's passed via search and match
<lopex> just like in oni
<lopex> just that the condition for creating region is earlier during match constructiojn
<enebo> Matcher matcher = reg.matcher(strBL.unsafeBytes(), beg, beg + strBL.realSize());
<enebo> so I see how we are calling some of these
<enebo> lopex: so you don't like passing in a Match option to the Regexp since you may or may not want the matcher to use regions
<lopex> I think we could just add a flag to that
<enebo> lopex: so we should create an int options to matcher method
<lopex> enebo: all this complication is so that we can reuse matches
<lopex> unlike mri does
<enebo> oh MRI always remakes them
<lopex> er, matcher
<enebo> do we reuse matcher?
<lopex> enebo: like in scan etc
<lopex> we use same instance over again
<enebo> ok well so adding an overload with options field which we right now only check for some new option for eliminate region would be good enough?
<enebo> or basically the design you think would work best
<enebo> matcher(byte[], int beg, int len, int options)
<enebo> and what Option should we make for that?
<lopex> I'd go for a boolean at most, or even directly allocate/no allocate region in overloaded versions
<lopex> like matcheNoRegion
<enebo> why do we even have a MatcherFactor?
<lopex> because there's alternative one for asmified regexps
<enebo> I see it
<enebo> the easiest way to impl it would be to add boolean to matcher in Regexp use factory and then set some boolean on base Matcher after it is made
<enebo> which is probably not the most elegant way to do it
<lopex> actially I'm for this matcherNoRegion thingy
<enebo> so ByteCodeMachine is version with that logic
<enebo> and we extend and make another opEnd method?
<lopex> no
<lopex> ah, I dont mean that at all
<enebo> hahaha ok
<lopex> I mean another method in matcher factory
<enebo> ah so two methods one for regions and one for no regions
<lopex> one step ahead and we're just at where mri is
<lopex> where region is created externally
<enebo> oh so we make region and pass into Matcher
<lopex> except that we still can reuse matchers
<enebo> or don't
<enebo> and factory can do that
<lopex> yes, plust that zero group version
<lopex> condition
<enebo> I am almost following
<lopex> I think that's better
<enebo> the constructor of ByteCodeMachine sets up based on regexp.numMem
<lopex> I'll do that
<enebo> lopex: ok. I am super super excited to get this in
<enebo> lopex: at least I am really hoping it speeds up match?
<lopex> enebo: the whole hierarchy is reversed so that asm version fits in
Caerus has joined #jruby
<lopex> it started the other way round
<lopex> stack machine, bytecode, matcher
<enebo> do we use AsmCompilerSupport?
<lopex> no
<enebo> I could see how we could emit it for literal regexp in JIT
<lopex> but it's still a good start
<enebo> Not sure how much it would help or not
<enebo> It would get rid of one level of indirection of having a callsite
<enebo> It could be really useful for named captures
<enebo> If we provide some asm hook for setting lvar values for named captures
<enebo> I guess we still need to make backref
<lopex> afair I was overwhelmed how to compile subexp calls in asm
<lopex> but most of bytecode compilation wouldnt be that hard
<enebo> JIT joni bytecode still seems a good idea
<lopex> more of a aot
<lopex> well, for throw away regexps the interpreter still would be better I guess
<enebo> yeah it would be for same purpose of a JIT though...call regexp enough to be hot you generate bytecode which does it
<enebo> I was thinking it has some nice properties too if you JIT an engine for a specific regexp you can probably delete all unused instrs from it
<enebo> and if it has no captures or something like that you can remove a lot of logic which is not used
<enebo> I guess JVM JIT is pretty good at eliminating unused stuff so maybe it would be a wash
<lopex> oh, I though about completely separate logic for that compiler
sgeorge has quit [Remote host closed the connection]
<lopex> thought
<enebo> well it seems there are multiple ways this can be done
<lopex> it would go from ast
<enebo> sure
<lopex> directly, since all of the optz are on ast
<lopex> enebo: there's a template AsmCompiler.java
<enebo> I was looking at instrs since it is closer to IR and how our JIT operates
<lopex> I begun to install all bitsets, and string templates as fields
sgeorge has joined #jruby
sgeorge has quit [Ping timeout: 268 seconds]
<enebo> lopex: did quick and dirty. I will see if I can see a benefit
<enebo> no = pattern.nameToBackrefNumber(sBytes, name, nameEnd, regs);
<enebo> lopex: did some methods go away in joni?
<lopex> enebo: it's in scan env now
<enebo> how do I get that?
sgeorge has joined #jruby
<lopex> whoops
<lopex> I thought I checked that
<enebo> 4 callers in JRuby for it
<lopex> yep
<enebo> lopex: this is fine so I guess Matcher could have this method on it
<enebo> lopex: or expose getScanEnvironment
<enebo> lopex: seems like not exposing that is more desirable
<lopex> scan env is on parser, so it's no longer there
<enebo> it is in lexer and that is what Matcher is right?
<lopex> no
sgeorge has quit [Ping timeout: 240 seconds]
<enebo> hah ok yeah
<enebo> oh yeah it goes away
Caerus has quit [Ping timeout: 240 seconds]
sgeorge has joined #jruby
claudiuinberlin has joined #jruby
<lopex> enebo: yeah, I was too fast with that nametable move
<lopex> enebo: when do you want to push this in ?
<enebo> lopex: IMMEDIATELY
<enebo> lopex: seriously though match? is being used for perf by MRI so we should be faster
<enebo> and I think we can use it to speed up date parsing
<lopex> internally ?
<lopex> or by the aps ?
<enebo> I think Ruby libraries are using match? now because it is several times faster
<enebo> but in JRuby it isn't
<enebo> I guess I mean to say it is becoming a popular method because it is fast
mistergibson has joined #jruby
<enebo> So we got a pretty good bump in performance not creating regions but it is not nearly what MRI got from it
<lopex> enebo: and the backref logic ?
<enebo> supposedly
<enebo> I am removing more code now though
<enebo> holder[] and some crap like that which is not needed
<enebo> I did get a little bit more
<enebo> 2-2.1Mop/s to about 3M
<enebo> it was like 2.7 and 2.9 before I removed holder
<enebo> so 3M i/s vs 5.2 i/s on MRI
<enebo> so we gained about 50% perf removing region and not messing with setting threadlocal backtrace
<lopex> enebo: it's rb_reg_search0 vs rb_reg_match_p
<enebo> some of that is just removing the need for stuff like holder
<enebo> so we need a different entry point then?
<enebo> I did just continue to use matcherSearch but with regionless Matcher
<enebo> although we also can interrupt our regexps
<enebo> oh I see we can do match in SearchMatch
<enebo> changing SearchMatch to use matchInterruptible improved it more
<lopex> though they still use onig_search in rb_reg_match_p
<enebo> up to 4.3M i/s and 4.8 i/s
<enebo> so getting much closer to MRI now
<lopex> but all tainting, freezing and backref is not used
<lopex> enebo: do you also return true/false ?
<enebo> yes?
<lopex> well, current internal wont
<enebo> with graal CE rc4 we are at 5.5M i/s
<lopex> jruby internalss
<enebo> return context.runtime.newBoolean(matchPos(context, str, 0) >= 0);
<enebo> do you mean that?
<lopex> I'm for separate mehtod like that rb_reg_match_p
<lopex> ah, yes
<enebo> so what is matchInterruptible in comparison?
<enebo> That nearly got us to MRI speeds
<enebo> and honestly the warmup is a bit too short we probably do beat MRI if we run a little longer
<lopex> enebo: and no setBackRefInternal in the path ?
<enebo> lopex: I should have removed them all
<enebo> lopex: I just duplicated all the methods down and removed stuff not needed
<enebo> I think anyways
<enebo> but no backref methods any more
<lopex> enebo: and thecode on opEnd ?
<enebo> it is there
<enebo> but region == null
<enebo> I gave you a diff earlier
<lopex> yes, but it's a bit off
<lopex> lookat the else
<enebo> lopex: so we should just remove that code then
<lopex> or, hmm
<lopex> enebo: well, that if (region != null) is older than that optimization in mri
<lopex> it was to not use region if there's no groups in the regexp
<enebo> lopex: does make me wonder if extending this with more pruned down code would make more sense
<lopex> extending ?
<enebo> ByteCodeMachine
<lopex> you want to morphise opEnd ?
<lopex> definitely not
<enebo> heh yeah I guess not
<enebo> bimorphic for this would be pain ful
<enebo> other option is to copy it
<enebo> but I can see why that is icky too
<lopex> too late for bytecode rewriting :P
<lopex> well, we could use somethng like that actually
<lopex> but I dont know if it's worth the hassle
<enebo> so much code
<enebo> In this case this is called when opEnd
<enebo> oh so normative exit instr?
<enebo> I guess it is variable
<enebo> your compile this could get rid of tons of simple invariants and maybe some of these methods would inline
<enebo> compile this == asm or compile from AST or bytecode either way
<enebo> lopex: that else is confusing to me too
<enebo> lopex: msaBegin/End seems like it is direct relation to msaRegion
<enebo> lopex: but this else only exists when there is no msaRegion
<enebo> lopex: so why are these values being calculated?
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
shellac has joined #jruby
shellac has quit [Client Quit]
<enebo> lopex: if I stop using matchInteruptible for match then we go from 4.9M i/s to about 5.5M
<lopex> enebo: because there might be no region is there's no captures
<lopex> enebo: and you still want to be able to return match begin/end
<enebo> but how would that be returned?
<lopex> enebo: via on demand region instance
<lopex> enebo: getEagerRegion
<enebo> but getEagerRegion is 'return msaRegion != null ? msaRegion : new Region(msaBegin, msaEnd);'
<lopex> yes
<enebo> haha I reversed the logic
<enebo> ok so it is possible to make something on demand then I see
<enebo> do we do that?
<lopex> under jruby I guess not
<enebo> So I am realizing we have two engines for sb and nonsb
<lopex> yes
<enebo> we could probably have a third for fast matching
<enebo> then we may have a few more methods on the class but those could nuke all this setting if we don't actually need it
<lopex> well in that case we could do much more in separate opcode that relate to captures
<lopex> opcodes
<enebo> yeah I somewhat mean that
<enebo> although in some cases existing opcodes would be used and any region logic would just be removed from that version
<lopex> but you cant get rid of them
<lopex> oh, hmm
<lopex> referred
<lopex> enebo: !!
<enebo> lopex: Not sure if you are happy or sad
<lopex> we know upfront I guess if there something like (.)\1
<enebo> yeah
<lopex> then $1 is referred in terms of oni
<enebo> we know lots of stuff before it starts
<lopex> but what worried me is all that special casing just for match?
<lopex> er "match?"
<enebo> well we don't know how much benefit
<lopex> enebo: so interruptible slows so much ?
<enebo> 68 consumers in Rails 5.1 core
<enebo> seems to unless matchInterruptible does more than match beyond that
<enebo> This is highly synthetic bench too
drbobbeaty has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<enebo> no doubt in a more multi core use-case ala Rails we would not see the same penalty
<enebo> but who knows then since we are executing tons of other code at same time
<enebo> lopex: but going back to Rails 68 calls to match? in core code means people are using it because it is fast
<enebo> lopex: so it likely is important for us to do it quickly too
<enebo> lopex: since people will leverage it for the SPEEDZ
<enebo> lopex: but I don't think we should make some huge unmaintainable mess either
<lopex> yeah, that's why I was postponing it
<lopex> but since we have much cleared picture now..
<lopex> I'll look again at mri too
<enebo> lopex: tbh the stuff I did today was not very invasive to joni
<enebo> probably more changes to JRuby itself to not call through some massive set of common methods
<enebo> but I also think we could start with the same general strategy I did today in making a matcherNoRegions to factory and then later consider more invasive changes to joni interp for specialized or simpler matcher
<lopex> enebo: though but that getEagerRegion isnt use in joni, we still benefit from it since lots of core uses just getBegin / getEnd directly
<lopex> and not begin[0] and end[0]
<lopex> enebo: er, getEager isnt used in jruby
<enebo> This is the patch I ended up with for joni but I did revert your other change of that method to scanEnv
<lopex> enebo: I'd even pass that region from factory methods
<lopex> but that's nitpicking
<enebo> lopex: yeah I went for minimal amount of work while trying to achieve your factory-based API
<enebo> lopex: getEager is fine to keep but if we decide to try and improve match perf I think we can make a match engine and probably reduce the complexity of what we call for each op code
<enebo> that will just be another code path from execute
<enebo> but I have no idea if that will help perf or not either
<enebo> that msaBegin+ logic is pretty simple math
<enebo> I would think best case for specialize execute for match would be stripping logic down to the point some more stuff inlines
<lopex> enebo: since asm stuff isnt loader the factory method sohuld be considered ply
<lopex> polu
<lopex> er, poly
<lopex> er
<lopex> mono
<lopex> doh
<enebo> haha
<enebo> yeah
<enebo> you reflective call should eliminate that being a problem
<lopex> reflective ?
<enebo> newInstance
<lopex> ah, right
<enebo> match? 7.255M (± 9.8%) i/s - 35.918M in 5.007063s
<enebo> graal ce rc4 without interruptible
<lopex> but hwre ?
<lopex> where newInstance ?
<enebo> regex.factory = (MatcherFactory)cls.newInstance();
<enebo> in AsmCompilerSuppoert
<enebo> I guess it hardly matters since it is not even used
<enebo> our usage will be mono since we only use one type
<lopex> enebo: but it's a dead code now
<enebo> yeah exactly
<lopex> enebo: you could try omitting the factory api
<lopex> jus to see
<enebo> yeah I guess so
<enebo> I would be super surprised if that all did not inline away
<enebo> single type at single point calling a method which is just invoking a constructor
<enebo> tiny method mono
<enebo> unless the budget ran out
<enebo> lopex: so you plan on implementing this soon?
<lopex> enebo: the thing you just dirty checked ?
<enebo> lopex: well something which allows us to match in joni without regions being created
<enebo> lopex: I don't care if you do it like I did or how you like it
<lopex> enebo: probably almost identical
<lopex> but yeah
<enebo> lopex: ok
<enebo> lopex: I am pumped!
<lopex> enebo: can you post jruby diff for reference too ?
<enebo> lopex: sure it is a bit more playful than serious
<lopex> yeah, I get it
<lopex> I need to move that by number back on regexp
<enebo> yeah I did it locally
<enebo> I just did a revert and then that had a tiny conflict
<lopex> but neither sequel/sinatra/rack dont use match?
<lopex> enebo: active support does quite a bit
<enebo> lopex: yeah although I expect all libraries will eventually in hot spots
<enebo> optimizing for rails is not the end of the world for us either :P
<lopex> enebo: and what about that cache and strftime ?
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<enebo> lopex: oh that was just me saying I got good perf out of making a cache
<enebo> lopex: remember I forgot we cached regexp
<lopex> enebo: so maybe it didnt go through that cache ?
<enebo> lopex: what didn't?
<enebo> strftime does not use joni
<lopex> the bytelists
<lopex> ah
<enebo> It has it's own parser
Caerus has joined #jruby
sgeorge has quit [Remote host closed the connection]
ahorek has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
sgeorge has joined #jruby
sgeorge has quit [Ping timeout: 240 seconds]
Caerus has quit [Ping timeout: 256 seconds]
ahorek has joined #jruby