#ifstream bidir iterator

3 messages · Page 1 of 1 (latest)

remote flint
#

https://gist.github.com/mgood7123/645088975d73d7d0361fc44ebe4b888a

in the above code

(with entire file content pre-loaded)

my iterator takes around 3 seconds to iterate ~1.3k files totaling ~195 mb in size

meanwhile my mmap iterator (also included) takes ~0.4 seconds for the same thing

how can i bring the performance of my ifstream bidir closer to the performance of my mmap iterator ?

Gist

GitHub Gist: instantly share code, notes, and snippets.

remote flint
#

Anyone ?

tardy fulcrum
#

do_op is a terrible interface. It's rife with undocumented magic numbers. Do you have a limit on how many functions you are allowed to write?
Putting a vector on the heap is suspicious (buffer in LargeBuffer). Vector itself keeps its data on the heap. If you want to support move operations, vector can do that for you.
Also, you're not sharing vectors between LargeBuffers, so buffer should be at most a unique_ptr, not shared_ptr. shared_ptr should be the last resort, after stack-based values and unique_ptr