用于编译的 RAM 驱动器 - 有这样的东西吗? [英] RAM drive for compiling - is there such a thing?

查看:19
本文介绍了用于编译的 RAM 驱动器 - 有这样的东西吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

答案 (见下文) StackOverflow 上的一个问题让我想到了一个伟大的小软件,它对世界各地的编码人员都是无价的.

An answer (see below) to one of the questions right here on Stack Overflow gave me an idea for a great little piece of software that could be invaluable to coders everywhere.

我正在想象 RAM 驱动器软件,但有一个重要的区别 - 它会在我的硬盘驱动器上镜像一个真实的文件夹.更具体地说 - 包含我目前正在处理的项目的文件夹.这样,任何构建都将几乎是瞬时的(或至少快几个数量级).RAM 驱动器将在后台仅使用空闲资源将其内容与硬盘驱动器同步.

I'm imagining RAM drive software, but with one crucial difference - it would mirror a real folder on my hard drive. More specifically - the folder which contains the project I'm currently working on. This way any builds would be nearly instantaneous (or at least a couple orders of magnitude faster). The RAM drive would synchronize its contents with the hard disk drive in background using only idle resources.

快速的谷歌搜索什么也没发现,但也许我只是不知道如何谷歌.也许有人知道这样的软件?最好是免费的,但合理的费用也可以.

A quick Google search revealed nothing, but perhaps I just don't know how to Google. Perhaps someone knows of such a software? Preferably free, but reasonable fees might be OK too.

添加: 已经提出了一些解决方案,但我一开始就放弃了.它们将是(无特定顺序):

Added: Some solutions have been suggested which I discarded in the very beginning. They would be (in no particular order):

  • 购买速度更快的硬盘驱动器(SSD 或者 10K RPM). 我不想要硬件解决方案.不仅软件有可能更便宜(免费软件,有人吗?),而且还可以在硬件修改即使不是不可能的情况下也不受欢迎的环境中使用 - 例如,在办公室.
  • 让 OS/HDD 进行缓存 - 它更知道如何使用您的空闲 RAM. OS/HDD 具有通用缓存算法,可以缓存所有内容并尝试预测哪些数据最需要未来.他们不知道对我来说优先级是我的项目文件夹.众所周知 - 他们并没有真正缓存它.;)
  • 周围有很多 RAM 驱动器;使用其中之一. 抱歉,那太鲁莽了.只要有空闲时间,我就需要将我的数据同步回 HDD.如果发生电源故障,我可以忍受失去最后五分钟的工作,但不是我上次签到后的所有工作.
  • Buy a faster hard disk drive (SSD maybe or 10K RPM). I don't want a hardware solution. Not only software has the potential to be cheaper (freeware, anyone?), but it can also be used in environments where hardware modifications would be unwelcome if not impossible - say, at the office.
  • Let OS/HDD do the caching - it knows better how to use your free RAM. The OS/HDD have generic cache algorithms that cache everything and try to predict which data will be most needed in the future. They have no idea that for me the priority is my project folder. And as we all know quite well - they don't really cache it much anyway. ;)
  • There are plenty of RAM drives around; use one of those. Sorry, that would be reckless. I need my data to be synchronized back to the HDD whenever there is a bit of free time. In the case of a power failure I could bear losing the last five minutes of work, but not everything since my last checkin.

添加 2: 一个想法 - 使用普通 RAM 驱动器和背景文件夹同步器(但我的意思是 背景).有这种东西吗?

Added 2: An idea that came up - use a normal RAM drive plus a background folder synchronizer (but I do mean background). Is there any such thing?

添加了 3 个: 有趣.我刚刚在工作中尝试了一个简单的 RAM 驱动器.重建时间从 ~14 secs 下降到 ~7 secs(不错),但增量构建仍然在 ~5 secs - 就像在 HDD 上一样.任何想法为什么?它使用aspnet_compileraspnet_merge.也许他们对别处的其他临时文件做了什么?

Added 3: Interesting. I just tried out a simple RAM drive at work. The rebuild time drops from ~14 secs to ~7 secs (not bad), but incremental build is still at ~5 secs - just like on the HDD. Any ideas why? It uses aspnet_compiler and aspnet_merge. Perhaps they do something with other temp files elsewhere?

添加了 4 个:哦,不错的新答案!:) 好的,我为所有反对者提供了更多信息.:)

Added 4: Oh, nice new set of answers! :) OK, I've got a bit more info for all you naysayers. :)

这个想法的主要原因之一不是上述软件(14 秒构建时间),而是另一个我当时无法访问的软件.这个另一个应用程序有一个 100MB 的代码库,它的完整构建需要大约 5 分钟.是的,它在 Delphi 5 中,所以编译器不太先进.:) 将源放在 RAM 驱动器上会产生很大的不同.我想不到一分钟就搞定了.我没测过所以对于那些说操作系统可以更好地缓存内容的人 - 我不同意.

One of the main reasons for this idea is not the above-mentioned software (14 secs build time), but another one that I didn't have access at the time. This other application has a 100 MB code base, and its full build takes about 5 minutes. Ah yes, it's in Delphi 5, so the compiler isn't too advanced. :) Putting the source on a RAM drive resulted in a BIG difference. I got it below a minute, I think. I haven't measured. So for all those who say that the OS can cache stuff better - I'd beg to differ.

相关问题:

用于加速IDE的RAM磁盘

第一个链接注意:它链接到的问题已被删除,因为它是重复的.它问:

Note on first link: The question to which it links has been deleted because it was a duplicate. It asked:

你在编译代码时在做什么?

What do you do while your code’s compiling?

我链接到的 Dmitri Nesteruk 的答案是:

And the answer by Dmitri Nesteruk to which I linked was:

我几乎立即编译.部分原因是我的项目很小,部分原因是使用 RAM 磁盘.

I compile almost instantly. Partly due to my projects being small, partly due to the use of RAM disks.

推荐答案

在 Linux 中(你从来没有提到你在哪个操作系统上,所以这可能是相关的)你可以从 RAM 创建块设备并像安装任何其他块设备(即 HDD)一样安装它们.

In Linux (you never mentioned which OS you're on, so this could be relevant) you can create block devices from RAM and mount them like any other block device (that is, a HDD).

然后,您可以创建在启动/关闭时以及定期复制到该驱动器或从该驱动器复制的脚本.

You can then create scripts that copy to and from that drive on start-up / shutdown, as well as periodically.

例如,您可以将其设置为具有 ~/code~/code-real.您的 RAM 块在启动时安装在 ~/code 处,然后 ~/code-real(位于您的标准硬盘驱动器上)中的所有内容都被复制.关闭时,所有内容都会从 ~/复制回来(rsync 会更快)代码~/code-real.您可能还希望该脚本定期运行,以便在发生电源故障等情况时不会丢失太多工作.

For example, you could set it up so you had ~/code and ~/code-real. Your RAM block gets mounted at ~/code on startup, and then everything from ~/code-real (which is on your standard hard drive) gets copied over. On shutdown everything would be copied (rsync'd would be faster) back from ~/code to ~/code-real. You would also probably want that script to run periodically, so you didn't lose much work in the event of a power failure, etc.

我不再这样做了(我将它用于 Opera9.5 测试版很慢,不再需要了).

I don't do this anymore (I used it for Opera when the 9.5 beta was slow, no need anymore).

这里是如何在 Linux 中创建 RAM 磁盘.

这篇关于用于编译的 RAM 驱动器 - 有这样的东西吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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