chetanc10 / cxml

C based XML encoder/decoder library
GNU General Public License v2.0
0 stars 0 forks source link

Node Content Pooling #3

Open chetanc10 opened 6 years ago

chetanc10 commented 6 years ago

Need to update the library such that the Node contents shall be allocated memory as a whole.

We allocate a pre-defined size of buffer of 64 bytes and grow it in steps if required. Call it as NCP (Node Content Pool) memory. Each node content string and the relevant attribute key-pair strings shall be placed in that memory in an incremental fashion, with the corresponding xml-node holding the offsets of these strings instead of pointers. Once the node list is complete, the xml string is then allocated and contents are copied in an xml fashion.

This removes per-node content buffer allocations grouping them all in a one-time allocated buffer in best case ad in worst case it could be single-digit number of allocation based on xml string length.

chetanc10 commented 6 years ago

Need a revisit.

Possible to eliminate nodes completely and have just 1 context structure building xml-string OTG with contents between relevant delimiters with Opening/Closing delimiter counters. If all counters match, xml string is final and ready to be used by application