if provider is in-memory: do sort+flush in same goroutine
if provider is file-based: do sort+flush in another goroutine, and Load method will wait for unfinished goroutines and return error if one happened inside goroutine. Also in this case do pre-palloc of new buffer with prevBufSize/8 size - because can't re-use prev buffer in this case.
Reason: E4 has 8 etl collectors in same time (for domains/history/inverted_indices) and sort.Stable is kind-of bottleneck.
prevBufSize/8
size - because can't re-use prev buffer in this case.Reason: E4 has 8 etl collectors in same time (for domains/history/inverted_indices) and
sort.Stable
is kind-of bottleneck.