|
|
Hi,各位同学
网上总有各种关于用tmpfs来speed up firefox的技巧和文章,我就此事有点疑问,下面是我的实验:
准备工作:
首先我用一个脚本speedfox.sh来代替firefox的启动,这个脚本的功能是,将 ~/.mozilla-hdd复制到/tmp/mozilla-hdd,删除~/.mozilla , 创建从/tmp/mozilla-hdd 到 ~/.mozilla的连接。
好了,现在试验开始
1. 重启。没有启动tmpfs,启动firefox前,输出free -m
[php]
total used free shared buffers cached
Mem: 1506 256 1250 0 22 106
-/+ buffers/cache: 127 1379
Swap: 972 0 972
[/php]
2. 用speedfox.sh启动firefox,输出free -m
[php]
total used free shared buffers cached
Mem: 1506 764 742 0 19 590
-/+ buffers/cache: 154 1352
Swap: 972 0 972
[/php]
修改fstab自动挂载/tmp为tmpfs
3. 重启。启用tmpfs,启动firefox前,输出free -m
[php]
total used free shared buffers cached
Mem: 1506 256 1250 0 22 106
-/+ buffers/cache: 127 1379
Swap: 972 0 972
[/php]
4. 用speedfox.sh启动firefox,输出free -m
[php]
total used free shared buffers cached
Mem: 1506 711 795 0 12 557
-/+ buffers/cache: 141 1365
Swap: 972 0 972
[/php]
可以看出数据相差不大。
按照Wikipedia的说法(via http://en.wikipedia.org/wiki/Virtual_memory ):
Everything stored in tmpfs is temporary in the sense that no files will be created on the hard drive
那么Linux上tmpfs的实现是这样的(via). 理论上(因为我没看过源码)说是除非有swap,否则tmpfs的内容永远不会换出内存。
那么我的疑问是
speedfox之所以加快了以后 firefox 的速度只是由于Linux读写了所有.mozilla下的文件,所以他们都被cache 了,与tmpfs 貌似是关系不大。
但是从上面的测试是不是说明,将tmpfs作为.mozilla的存放点不见得是一个性价比特别高的操作?因为Linux的Cache在这里已经那么好用了,而用户还得承担同步/tmp/下的mozilla-hdd和~/.mozilla-hdd,来保持一致性 |
|