fuse
fuse copied to clipboard
Add handle HandleStreamingReader (performance improvements)
This commit introduces a new type 'StreamingReadResponse' which implements the io.Writer interface. Thus users are writing into the response rather than updating the Data property of ReadResponse. This allows us to preallocate the space for the whole message and therefore reduce allocations. Additionally we may now use a sync.Pool to manage the required space needed for the read request and further minimize allocations.
This patch intends to not break existing implementations of the fuse.HandleReader interface by introducing a new interface that provides the advantages described above.
I've benchmarked this using a scenario that is similar to the environment I need for the application I am currently developing. The benchmark reads data blobs of different sizes from the solid-state drive. Using this patch we can achieve a 1.60x speed up as well as reduce memory allocations by 85%.
Full disclosure: I am not to confident with the prefix 'Streaming' for the handle interface as well as the response type.