这是一个创建于 4941 天前的主题,其中的信息可能已经有所发展或是发生改变。
发现内存大量闲置,又闲的蛋疼,于是决定分出2G内存给浏览器做Cache。
1. 步骤
1.1. 将以下分隔符内代码保存为ramdisk.sh & chmod +x ramedisk.sh
---ramdisk.sh-----
#!/bin/sh
mount_point=/Volumes/ramdisk
ramfs_size_mb=2048
RamDisk (){
ramfs_size_sectors=$((${ramfs_size_mb}*1024*1024/512))
ramdisk_dev=`hdid -nomount ram://${ramfs_size_sectors}`
newfs_hfs -v 'RAM Disk' ${ramdisk_dev}
mkdir -p ${mount_point}
mount -o noatime -t hfs ${ramdisk_dev} ${mount_point}
mkdir ${mount_point}/chrome
mkdir ${mount_point}/firefox
mkdir ${mount_point}/safari
rm ~/Library/Caches/Google/Chrome/Default/Cache
rm ~/Library/Caches/com.apple.Safari
ln -s ${mount_point}/chrome ~/Library/Caches/Google/Chrome/Default/Cache
ln -s ${mount_point}/safari ~/Library/Caches/com.apple.Safari
}
RamDisk
----eof-----------
1.2. 将ramedisk.sh 加入当前用户的启动项 [System Preferences->System->Accounts->Login Items]
1.3. Firefox需要另外设置 about:config中添加browser.cache.disk.parent_directory项,类型为string,值为 /private/ramdisk/firefox/
2. 磁盘速度测试(单位为M/S):
2.1. HD
2011-04-08 22:34:29.420 AJA System Test[10449:1707] Average read rate = 51.95
2011-04-08 22:34:29.421 AJA System Test[10449:1707] Average write rate = 54.03
2.2. RAMDISK
2011-04-08 22:34:53.170 AJA System Test[10449:1707] Average read rate = 1642.24
2011-04-08 22:34:53.171 AJA System Test[10449:1707] Average write rate = 1835.27
5 条回复 • 1970-01-01 08:00:00 +08:00
|
|
1
eraser 2011-04-08 23:01:47 +08:00
|
|
|
3
forwap 2011-05-30 23:28:31 +08:00
就2G的内存,,泪奔..
|
|
|
4
yuhuofeihe 2011-05-30 23:33:45 +08:00
2G内存,压力很大~
|
|
|
5
Wowbeing 2011-05-30 23:59:01 +08:00
才4g,刚刚够平时用,看来目前用不上了。
|