shu--hung
2017-2-15 17:06:17

@shu—hung has joined the channel


samth
2017-2-15 23:01:32

@mflatt turns out it was simpler than I expected, unless something went unexpectedly wrong


samth
2017-2-15 23:01:41

sadly a lot of the numbers changed, so the diff is big


samth
2017-2-15 23:01:52

next up: all the streams stuff


sabauma
2017-2-15 23:05:53

@samth The regexp benchmark is now working


sabauma
2017-2-15 23:05:57

;; Racket ;; real 3m13.797s ;; user 3m13.124s ;; sys 0m0.768s

;; Pycket ;; real 4m57.301s ;; user 4m56.440s ;; sys 0m0.632s


samth
2017-2-15 23:06:28

@sabauma well done, but also :disappointed:


sabauma
2017-2-15 23:06:33

The upshot is that the we now support way more regexp features.


samth
2017-2-15 23:07:07

wait how does that work?


sabauma
2017-2-15 23:07:29

samth: Because our builtin support regexps is rather spotty.


sabauma
2017-2-15 23:07:45

Though quite fast.


mflatt
2017-2-15 23:08:07

@samth your diff makes sense, and I’ll merge sometime soon


samth
2017-2-15 23:08:23

ah, you mean that if you run regexps in pycket via the implementation in Racket that @mflatt wrote, we support more features


sabauma
2017-2-15 23:08:36

@samth: Precisely


samth
2017-2-15 23:08:40

but that isn’t what happens if you just use regexp-match in pycket


mflatt
2017-2-15 23:09:01

I’ve mostly been looking at the regexp and port expansions to make sure they don’t use keyword support; most of the work I did recently was to make the keyword support go away when it isn’t referenced


samth
2017-2-15 23:09:24

also, presumably the reason it’s slow is the usual interpreter problem


mflatt
2017-2-15 23:10:25

I was hoping that there wouldn’t be an interpreter problem because the regexp implementation uses a closure compiler; does that not avoid a dispatch that causes problems?


sabauma
2017-2-15 23:10:58

samth: Here the JIT stats ;; Tracing: 646 0.960233 ;; Backend: 646 0.229191 ;; TOTAL: 300.922709 ;; ops: 2911425 ;; recorded ops: 403920 ;; calls: 1415 ;; guards: 89566 ;; opt ops: 134253 ;; opt guards: 32524 ;; opt guards shared: 24801 ;; forcings: 0 ;; abort: trace too long: 0 ;; abort: compiling: 0 ;; abort: vable escape: 0 ;; abort: bad loop: 0 ;; abort: force quasi-immut: 0 ;; nvirtuals: 2684 ;; nvholes: 326 ;; nvreused: 372 ;; vecopt tried: 0 ;; vecopt success: 0 ;; Total # of loops: 130 ;; Total # of bridges: 516 ;; Freed # of loops: 18 ;; Freed # of bridges: 45


sabauma
2017-2-15 23:11:16

We produce quite a lot of code.


samth
2017-2-15 23:11:21

@sabauma that doesn’t look so bad


samth
2017-2-15 23:11:38

is 130 loops a lot?


sabauma
2017-2-15 23:11:48

I am supreised at how little time is spent tracing, actually.


sabauma
2017-2-15 23:12:32

Depends on the size of the code.


samth
2017-2-15 23:12:39

what if you run it a second time to reduce warmup?


sabauma
2017-2-15 23:12:42

It is pretty branchy.


sabauma
2017-2-15 23:13:43

@mflatt I’m not sure where the overheads are as of yet, so its hard to say.


sabauma
2017-2-15 23:13:56

only 27MB of JIT logs to comb through.


sabauma
2017-2-15 23:16:34

The number of loops would lead me to suspect it is creating 1+ loops per regexp. Which is what we would like.


samth
2017-2-15 23:20:24

might be worth starting with a smaller version of the benchmark


sabauma
2017-2-15 23:32:34

Looks like we’re hitting some bad points in our implementation of mutable hash tables.


mflatt
2017-2-15 23:33:22

FWIW, I was thinking of branches on the regexp AST, which closure compilation avoids. But there’s also branching on the input, which might amount to the same issue for tracing.


mflatt
2017-2-15 23:33:28

Or, in the best case, the tracing JIT might figure out that the benchmarks applies the same regexp to the same input many times, in which case it’s not a realistic benchmark


sabauma
2017-2-15 23:37:55

@mflatt: The regexp implementation in the Pycket runtime is just a jitted interpreter for regular expressions, and that has pretty good performance. In theory, at least, exposing the right information to the JIT should allow us to recover that performance.


sabauma
2017-2-15 23:41:18

(Un)fortunately, I doubt the JIT is smart enough to recognize and eliminate repeated runs of the same regexp on the same input, since the JIT has little context to work with aside from the current trace.


samth
2017-2-16 00:26:19

@mflatt about 7% (by lines) of the compiled bootstrap linklet is the sort implementation


samth
2017-2-16 00:26:32

does it seem worth it to try to shrink and/or remove that?


mflatt
2017-2-16 00:27:51

I have wondered whether it would be better to select a sort variant statically, instead of the current dynamic approach, so that referncing sort doesn’t mean referencing all the variants. Or have an explicit generic-sort that is used by the expander and doesn’t refer to the specialized variants.


samth
2017-2-16 00:28:51

I was thinking of the latter approach


samth
2017-2-16 00:29:21

the main difficulty is that the definition of sort has side effects, and so won’t be removed automatically


samth
2017-2-16 00:30:53

actually, that seems no longer true


samth
2017-2-16 00:31:18

so a generic-sort would work


samth
2017-2-16 00:31:21

I’ll try that


ajhager
2017-2-16 00:33:32

@ajhager has joined the channel


samth
2017-2-16 01:17:53

@mflatt that was easier than I expected


samth
2017-2-16 01:19:07

My changes take Flattened code is ... from about 614k to 564k


mflatt
2017-2-16 01:20:46

Great - thanks!


samth
2017-2-16 01:22:17

I could start writing a partial evaluator to remove some of the remaining struct definitions, but I’ll save that for another time