instaparse

If you're not trampolining your parser, why bother getting up in the morning?
Empperi 2017-12-13T09:48:06.000324Z

hmm, I have a rather large EBNF that I’m using to initialize an instaparse parser in ClojureScript

Empperi 2017-12-13T09:48:38.000291Z

It works just fine but the problem is that the parser creation takes a long time and since it’s ClojureScript that causes the UI to freeze while it is being created

Empperi 2017-12-13T09:49:01.000381Z

I was wondering if there is any way to do this in a webworker and if anyone has tried to do that before

Empperi 2017-12-13T09:49:25.000083Z

my initial feeling is that “no you cannot use webworkers” since they work with message passing and as such only Strings can be passed

Empperi 2017-12-13T09:50:33.000112Z

ideas?

2017-12-13T10:05:28.000125Z

@niklas.collin are you using the defparser macro?

Empperi 2017-12-13T10:05:53.000272Z

no, I’m using instaparse.core/parser

2017-12-13T10:06:24.000252Z

I wonder if you'd be faster if you'd be using the macro, then it precompiles a bit.

Empperi 2017-12-13T10:06:34.000312Z

dunno, maybe

Empperi 2017-12-13T10:06:41.000532Z

I could try

Empperi 2017-12-13T10:07:52.000189Z

well, that’s what the defparser documentation in instaparse github page says that it should work better

Empperi 2017-12-13T10:07:57.000064Z

thanks, will try that

👍 1
Empperi 2017-12-13T10:28:21.000320Z

yeah, now performance is pretty much instant

Empperi 2017-12-13T10:28:24.000496Z

cheers 🙂

aengelberg 2017-12-13T17:04:35.000169Z

@hlolli yep, that's exactly what it's meant for. @niklas.collin I'm glad it served its purpose!