最快的技术读取文件到内存? [英] fastest technique to read a file into memory?

查看:137
本文介绍了最快的技术读取文件到内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种被普遍接受的最快的技术,用于在c ++中将文件读入内存?



我将只读取文件。



我已经看到boost有一个实现,我在这里看到了一些其他的实现,但我想知道什么是最快的?



提前感谢您



如果情况重要,我考虑的档案高达1GB,这是Windows。

解决方案

使用内存映射文件< a>,也许使用提高封装容器



如果要读取大于虚拟地址空间的空闲连续部分的文件,则可以随意移动文件的映射部分。 / p>

Is there a generally-accepted fastest technique which is used to read a file into memory in c++?

I will only be reading the file.

I have seen boost have an implementation and I have seen a couple other implementations on here but I would like to know what is considered the fastest?

Thank you in advance

In case it matters, I am considering files up to 1GB and this is for windows.

解决方案

Use memory-mapped files, maybe using the boost wrapper for portability.

If you want to read files bigger than the free, contiguous portion of your virtual address space, you can move the mapped portion of the file at will.

这篇关于最快的技术读取文件到内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆