The performance baseline was a pleasant surprise, but does get me thinking: How complex is Jackson? It's thousands of lines of code. I know I just wrote this library to help avoid writing recursive descent parsers manually, but maybe for JSON specifically an approach like Go's scanner [1] is worth pursuing in Java.
As for Pex itself, lots of areas of potential optimization: 1) Better char matchers -- like int-mask based ones. Initial profiling suggested this. 2) Perhaps aggressive inlining of rules 3) Find out what Roberto Ierusalimschy did when he built a JIT for LPEG. He said it improved perf by 3x, but it's not in mainline. 4) Implement the TestChar and TestCharset bytecodes from the LPEG paper -- I have the AST to be able to do it. (It helps prevent call stack churn when you immediately jump into a rule and then fail because the first char doesn't match.) There is a valuable match capture optimization to perform too. 5) Perhaps tear apart the StackEntry object into int[]. VM debugging was such a PITA, I would have never finished it if I did that at the outset. [1] https://github.com/golang/go/blob/master/src/encoding/json/scanner.go On Thursday, November 19, 2015 at 3:58:47 PM UTC-5, Colin Fleming wrote: > > I'm really impressed by how fast it is out of the box with basically no > optimisations. Tatu Saloranta is fanatical about Jackson performance, > getting to within 6x on the first attempt is very promising. > > On 20 November 2015 at 02:43, Ghadi Shayban <gsha...@gmail.com > <javascript:>> wrote: > >> Thanks for taking a look. >> >> User-level bytecode allows me an easier choice to build a JIT or tracing >> infrastructure, while being far less complex than writing out JVM bytecode >> during grammar compile. >> >> Christophe has certainly been a help offline with design choices. I >> wanted PEG, no ambiguity, unlike instaparse or parsnip. Most of the API >> inspiration was from LPEG & Scala's Parboiled2. Some of the VM internals >> are close to JRuby's Joni regex engine. >> >> >> >> On Thursday, November 19, 2015 at 8:24:37 AM UTC-5, bernardH wrote: >>> >>> This is interesting ! >>> It reminds me of Parsnip from C.Grand [0], have you considered it when >>> desining pex ? As your parser is focusing of characters, I am wondering : >>> could the operations triggered by the execution of your pex code be simple >>> enough to warrant actual compiling to JVM bytecode (at run time, with ASM >>> [1]) for maximum performance ? >>> >>> Best Regards, >>> >>> Bernard >>> >>> [0] https://github.com/cgrand/parsnip/ >>> [1] http://asm.ow2.org/ >>> >>> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> <javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.