c++ - Memory consumption during parsing of YAML with yaml-cpp -
i developing qt application embedded system limited memory. need receive few megabytes of json data , parse fast possible , without using memory.
i thinking using streams:
json source (http client) ---> zip decompressor ---> yaml parser ----> objects mapped database
data arrive network slower can parse it.
- how memory yaml-cpp need parse 1mb of data?
- i parsed raw data decompressor , internal memory used data yaml parser released object mapped database created. possible?
- does yaml-cpp support asynchronous parsing? json object parsed, can store in database without waiting full content http source.
since have memory constraints , data in json, should use low-memory json parser instead of yaml parser. try jsoncpp - although i'm not sure support streaming (since json doesn't have concept of documents).
yaml-cpp is designed streaming, won't block if there documents parse stream still open; however, there outstanding issue in yaml-cpp reads more single document @ time, isn't designed extremely low memory usage.
as how memory takes parse 1 mb of data, on order of 3 mb (the raw input stream, plus parsed stream, plus resulting data structure), may vary dramatically depending on kind of data you're parsing.
Comments
Post a Comment