Hi,

Newbie to Nim, happy to be there.

I've been caught by the "Python but typed with meta-programming and compiling 
to standalone exe" kinda.

I give a try to Nim to process large json files.

I the doc of [parsejson](https://nim-lang.org/docs/parsejson.html) I saw 'This 
module implements a JSON parser. It is used and exported by the JSON standard 
library module, but can also be used in its own right.' Nice.

In run the following program on an 71MB input file, basically an array of 35k 
objects.
    
    
    import streams
    import parsejson
    
    var strm = newFileStream(system.stdin)
    
    var p = JsonParser()
    p.open(strm, "stdin")
    
    while true:
        p.next()
        case p.tok
        of tkEof:
            echo "end"
            break
        else: discard
    
    
    Run

Sorry for your bleeding eyes, it is my very first program in Nim.

It is pretty fast : 1.5s ; faster than jq - a least for the moment since it 
does nothing else than reading input.

But take a lot of RAM : 250MB. I was hopping a streaming parser to take a fix 
small amount of memory.

What did I miss ?

Thanks for your help 

Reply via email to