Archived

This topic is now archived and is closed to further replies.

Promit

One read vs. multiple sequential reads

Recommended Posts

Promit    13246
I''ve seen two major patterns in loading files (files like BSP, MD2, etc.) One is to load each block of data sequentially. The other is to load the entire file at once and then use memory offsets to pull data from the file buffer. If you assume no fseeks in either method, which is generally going to perform better?

Share this post


Link to post
Share on other sites
RenderTarget    398
Probably about the same, though I''m sure it''d depend on a number of factors. If they''re using a buffered file stream like fopen, it probably won''t be much different, unless the data blocks are big. In general, loading more data (up to a certain point) in one go is better, but it''s not all that deterministic without timings.

I like pie.

Share this post


Link to post
Share on other sites
SiCrane    11839
Depends on how the information is used, the block size in the first method, if the second method uses memory mapping, phase of the moon during compile, how buffering is performed, the underlying operating system, what kind of device the file is being pulled from, whether Mercury is in the third house at runtime, the total physical memory and page file size of the computer running the application, etc.

Share this post


Link to post
Share on other sites