Use :optimize :memory maybe? Section 10 here seems like your use 
case: https://github.com/Engelberg/instaparse/blob/master/docs/Performance.md
Watch htop and see if you have a process that is hitting swap without the 
optimization.
-Zack

On Wednesday, December 3, 2014 1:29:23 AM UTC-5, Sunil Nandihalli wrote:
>
> The file I tried it on is here 
> <https://gist.github.com/8c0daef5b832b58c86fa>
>
> On Wed, Dec 3, 2014 at 10:28 AM, Sunil S Nandihalli <sunil.na...@gmail.com 
> <javascript:>> wrote:
>
>> Hi Everybody,
>>  https://gist.github.com/cced1cf377ed49005704  *instaparse_question.clj* 
>> <https://gist.github.com/anonymous/cced1cf377ed49005704#file-instaparse_question-clj>
>> Raw 
>> <https://gist.github.com/anonymous/cced1cf377ed49005704/raw/220ff32218839db388261fd8e2489288a0093606/instaparse_question.clj>
>> 12345678910111213141516171819202122232425
>>
>> (ns lua-map-parser.instaparse-question
>>   (:require [instaparse.core :as insta]))
>>  
>> (let [parser (insta/parser
>>                "  lua-file = {map-decl|return-statement}
>>                   map-decl = <'local'> identifier <'='>  <'{'> { map-entry} 
>> <'}'> ;
>>                   identifier =  #'[a-zA-Z\\_][0-9a-zA-Z\\-\\_]*' ;
>>                   map-entry = <'['>  (string|number) <']'> <'='> 
>> (string|number) ;
>>                   string =  <'\\\"'> #'([^\"\\\\]|\\\\.)*' <'\\\"'> ;
>>                   number = integer | decimal ;
>>                   <decimal> = #'-?[0-9]+\\.[0-9]+' ;
>>                   <integer> = #'-?[0-9]+' ;
>>                   <return-statement> = <'return'> <identifier>"
>>                :auto-whitespace :comma)]
>>   (defn lua-map-parser [str]
>>     (parser str)))
>>  
>> (lua-map-parser "local CTRData = {
>> [1]=2 ,
>>  [\"3\"]=4 }
>> local MYData = { [\"hello\"] = \"world\"
>> [\"sunil\"] = 1 [\"satish\"] = \"office\"
>> [\"dad\"]=\"home\" }
>> return CTRData
>> ")
>>
>> The above grammar simply parses a map in lua-syntax. It works for the 
>> above case. However, when I try to use it on a file that is about 1 MB in 
>> size, it fails(not sure didn't wait longer than 2 minutes).  I would love 
>> to hear if there is something that is grossly inefficient in the way I have 
>> represented my grammar. The lua interpreter loads the file in no time (well 
>> 0.06 sec) . I would love any feedback on improving the grammar. Thanks
>> Sunil.
>>
>
>

-- 
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.

Reply via email to