akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.05k stars 808 forks source link

RPC: add json_array_swap_remove for O(1) remove from an array #601

Closed Mephistophiles closed 2 years ago

Mephistophiles commented 2 years ago

If it is helpful for jansson, I glad to create a PR to add the json_array_swap_remove function like in rust lang (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.swap_remove)

This new function makes removing from an array faster when preserving ordering is not required.

akheron commented 2 years ago

This doesn't sound very useful to me. Implementing algorithms is better done with faster/leaner data structures than Jansson's internal representation.