At Sat, 2 Mar 2019 12:24:22 -0500, Jon Zeppieri wrote:
> By contrast, the same file parses in roughly 160ms with the json
> module that ships with racket.
> [...]
> So I tested the existing library on the file, under racket-cs. (Actually, I
> think the version that came with this racket-cs build includes Matthew's
> recent improvements, so it's not exactly quite the same parser.) It parsed
> the file in 45-50ms.

Most of the difference there really us the new JSON parser, not Racket
vs Racket CS. With the new JSON parser and with the recently overhauled
I/O layers for Racket CS, I get 60ms for Racket and 40ms for Racket CS
on my machine.

> This 1MB sample file [...] takes about 20s to parse on my machine
> using my aeson-alike library. [...]
>
> So really, really slow.
> 
> Then I downloaded the most recent racket-cs build. My library parsed the
> same file in about 3.3s. So an *enormous* improvement.

That's a big difference between Racket and Racket CS. My initial
thought was that the program must have a lot of indirect function
calls, and Racket CS is faster at those... but not by such a big
factor. You don't use `call/cc`, right?

> It's not obvious to me why my parser is so slow. The haskell library from
> which it is unabashedly copied is known to be fast, and I don't think it
> leans heavily on laziness anywhere. One quirk of its design: each parser is
> passed a failure and a success continuation; they never return. So, on top
> of all the normal function-upon-function layering that you get in any
> parser combinator library, you get some extra here, since the continuations
> are heap-allocated closures.

A difference of 60ms/140ms versus 3.3s sounds algorithmic, as opposed
to something about the representation or cost of functions as
continuations.

How much memory does the program use, and how much of the run time is
GC time?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to