V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
eraser
V2EX  ›  macOS

RAMDISK 加速 Chrome,Safari,Firefox for MAC

  •  
  •   eraser · 2011-04-08 22:55:04 +08:00 · 10713 次点击
    这是一个创建于 4772 天前的主题,其中的信息可能已经有所发展或是发生改变。
    发现内存大量闲置,又闲的蛋疼,于是决定分出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
    eraser
        1
    eraser  
    OP
       2011-04-08 23:01:47 +08:00
    sparanoid
        2
    sparanoid  
    MOD
       2011-04-08 23:47:47 +08:00
    曾经用过的小工具: http://boredzo.org/make-ram-disk/

    把 ramdisk 分给浏览器当缓存没必要吧,我一般是把 ramdisk 作为 Photoshop 的 Scratch 盘

    如果有 64GB Mac Pro 的话,分 16GB 全部给 Photoshop 后性能提升会更爽
    forwap
        3
    forwap  
       2011-05-30 23:28:31 +08:00
    就2G的内存,,泪奔..
    yuhuofeihe
        4
    yuhuofeihe  
       2011-05-30 23:33:45 +08:00
    2G内存,压力很大~
    Wowbeing
        5
    Wowbeing  
       2011-05-30 23:59:01 +08:00
    才4g,刚刚够平时用,看来目前用不上了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   778 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 21:50 · PVG 05:50 · LAX 14:50 · JFK 17:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.