Open BrianSipos opened 2 months ago
Hi Brian, it's a good idea and happy to have it on the list. May take a while to get to it.
Do you have any specific issues with the memmove? For example, is it a performance issue with really large CBOR structures?
It could also be a part of make the object code of the encoder smaller.
The current interface with paired functions like
QCBOREncode_OpenArray()
andQCBOREncode_CloseArray()
use a late insertion of the array head during close when the size of the array is known by the encoder. This requires the use of memory insertion andmemmove()
though.In cases where the size of an definite-length array or map is known by the application before opening it, could there be a public function to write the size immediately at open?
Something like
This wouldn't be a change in capability of the encoder, just one of efficiency if the length is known at time of opening. The existing bookkeeping of number of items actually encoded could still be checked against this definite length so that an error occurs at CloseArray if the actual differed from the open length. Because it's not a difference of capability this is just a wishlist request.