FutureProofRetail / ember-cli-ramdisk

ARCHIVED: Replaces your broccoli tmp/ folder w ram disk for faster builds (?) / minimal SSD thrashing
MIT License
40 stars 6 forks source link

ImDisk on windows #2

Open ccoenen opened 10 years ago

ccoenen commented 10 years ago

I am currently investigating a patch to make this work on windows, as well. I have found ImDisk, which is open source. To my knowledge, windows can't create ramdisk on its own. I'll leave my findings here.

machty commented 10 years ago

@ccoenen ImDisk makes sense; I took a stab at this but got mired in general Windows unfamiliarity but I think ImDisk is the way to go; not sure how you want to handle automatically assigning a drive letter and sharing with other projects though.

I'm excited to see if this makes a dent in windows compilation; honestly I think enough enhancements have been made to ember-cli lately that I don't see a difference any more on Macs at least when using this addon.

ccoenen commented 10 years ago

I'm already hitting blockers: apparently, one needs admin-privileges for assigning driveletters and formatting the created ramdisks. Not sure how/if this would work in a broccoli context at all. I will absolutely not require people to run node with admin privileges.

# creates a 2G Ramdisk, formats it as ntfs, assigns letter "M:" to it (eMber, get it? :o) )
imdisk -a -s 2G -m M: -o fix -p "/fs:ntfs /q /y"
# remove the first ramdisk (no checks, yet)
imdisk -d -u 0

I'll try to incorporate these in the existing files.

machty commented 10 years ago

In that case it's probably fine if you isolated the command and made the user run that part manually in Admin mode.

ccoenen commented 10 years ago

Yes that's probably the best way to go about it. This could also take care of symlinking or NTFS junctions, AFAIK they need admin privileges, too.

miguelcobain commented 10 years ago

Linux also requires admin privileges (I was quite surprised OS X didn't). What we are doing right now is to execute sudo, and the terminal will ask for a password. I've found some npm packages that "wrapped" my comands with sudo, in a fancier way, but I ended up not using them.

On windows I found this: https://github.com/coreybutler/node-windows It is basically a wrapper for various windows stuff. Quoting the interesting part:

  • Commands:
    • Elevated Permissions: Run a command with elevated privileges (may prompt user for acceptance)

It looks like it might work.

EDIT: The elevate command uses child processes, so we need callbacks. Right now execSync is synchronous. Some things must be changed, but I agree with going with callbacks/promises on this.

machty commented 10 years ago

Who's Tom Dale?

miguelcobain commented 10 years ago

LOL!

cmosguy commented 9 years ago

@machty @ccoenen I too got fed up with performance on windows with the existing broccoli. I just found your discussion after experimenting with http://memory.dataram.com/products-and-services/software/ramdisk RAMDisk by Dataram. I downloaded the free version because I didn't need anything more than 4G for the tmp directory.

  1. First download and install.
  2. Create a drive, I chose 400MB for my needs.
  3. When it creates the new drive, click on it drive letter in windows. Right click, select Format... then chose NTFS.
  4. In my instance it created a drive letter g:
  5. Go into your ember project directory, delete the tmp folder.
  6. Create tmp folder in your new drive
  7. run the command in cmd shell: cmd mklink /J tmp g:\tmp

After that you should see a performance jump.

ccoenen commented 9 years ago

@cmosguy does the dataram dramdisk require a privilege elevation? (i.e. UAC Screen or Admin-Login...)

cmosguy commented 9 years ago

@ccoenen as far as i can tell it requires no admin privileges.