Conversation
|
Thanks for the PR! I haven't benchmarked myself, but a quick google search suggests that malloc + free is faster when you don't want to keep the previous data. |
|
The old implementation was optimized to both insertions in the middle and at the end. With Realloc, appending is now faster, when the memory area could be expanded, and about as fast when the array had to be copied. What do you think about the change in the array? @akheron |
|
Well, I've always maintained the guideline that jansson is not a data structure or algorithm library. As such, raw speed is not a priority, only a convenience 😄. I think the array code is now better, as it's easier to understand AND faster in some cases. |
Make use of realloc. This can be a significant performance improvement.