gpt4 book ai didi

c++ - "live C++ objects that live in memory mapped files"?

转载 作者:IT老高 更新时间:2023-10-28 22:40:01 26 4
gpt4 key购买 nike

因此,我在 Gamasutra 阅读了 John Carmack 的采访,其中他谈到了他所谓的“存在于内存映射文件中的实时 C++ 对象”。以下是一些引用:

JC: Yeah. And I actually get multiple benefits out of it in that... The last iOS Rage project, we shipped with some new technology that's using some clever stuff to make live C++ objects that live in memory mapped files, backed by the flash file system on here, which is how I want to structure all our future work on PCs.

...

My marching orders to myself here are, I want game loads of two seconds on our PC platform, so we can iterate that much faster. And right now, even with solid state drives, you're dominated by all the things that you do at loading times, so it takes this different discipline to be able to say "Everything is going to be decimated and used in relative addresses," so you just say, "Map the file, all my resources are right there, and it's done in 15 milliseconds."

(完整采访见here)

有没有人知道卡马克在说什么以及如何设置这样的东西?我在网上搜索了一会儿,但似乎找不到任何相关内容。

最佳答案

这个想法是,您可以通过内存映射访问该文件,从而始终将您的全部或部分程序状态序列化到一个文件中。这将要求您没有通常的指针,因为指针仅在您的进程持续时才有效。相反,您必须从映射开始存储偏移量,以便在重新启动程序并重新映射文​​件时可以继续使用它。这种方案的优点是你没有单独的序列化,这意味着你没有额外的代码,你不需要一次保存所有状态——相反,你的(全部或大部分)程序状态是始终由文件支持。

关于c++ - "live C++ objects that live in memory mapped files"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7159271/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com