index icon indicating copy to clipboard operation
index copied to clipboard

Use an `{encode,decode}_bin`-like interface for encoding/decoding

Open pascutto opened this issue 4 years ago • 1 comments

One remaining spot of allocations in index lives in the interface between index and repr, in the Key.encode: t -> string and Value.encode: t -> string functions of the functor argument.

These function allocate strings, but these are then blit into already existing buffers, then blit again in a file. This allocation should be avoided, by using an interface closer to repr's encode_bin.

Similar reasoning applies to decode, as this is heavily used during merges to decode all data keys.

pascutto avatar Mar 17 '21 13:03 pascutto

See https://github.com/mirage/index/pull/287

mattiasdrp avatar Mar 24 '21 14:03 mattiasdrp