Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to know that ramdisk is being used? #9

Open
0xabrarhussain opened this issue Oct 15, 2021 · 5 comments
Open

How to know that ramdisk is being used? #9

0xabrarhussain opened this issue Oct 15, 2021 · 5 comments

Comments

@0xabrarhussain
Copy link

So for my Electron project I'm also using the filesystem cache with the following:

  cache: {
    type: 'filesystem',
  },

I don't have output/path set in my webpack rules. During the build step I see the following:

⠋ Compiling Renderer Template⬡ webpack-plugin-ramdisk: Build being written to /Volumes/wpr/myname/myproject 
✔ Compiling Renderer Template
✔ Preparing to Package Application for arch: x64

But ramdisk didn't seem to make any different at all to build times.

Is there a way for me to verify it's being used? I do see the Volume mounted, but I don't know if it's being read.

@shellscape
Copy link
Owner

You'd have to watch I/o on the virtual disk. If you're not already using memory-fs, and you're outputting to a regular file location on a physical disk, and using ramdisk no longer outputs to that physical disk, you could be fairly certain the virtual disk is being used. It's rare but there are some situations where it may not make much of a difference.

@0xabrarhussain
Copy link
Author

0xabrarhussain commented Oct 18, 2021

The normal filesystem cache writes to node_modules/.cache/webpack. Tried deleting everything there and building with ramdisk included, and seems that still gets filled up fully again.

Using the filesystem cache pretty much cuts my build time in half, so I'm pretty confident ramdisk would make a larger impact. But from what you're saying doesn't sound conclusive it's being used at all.

Tried also only including ramdisk and no filesystem cache, and that didn't seem to really do anything to build times (maybe 5s off?).

@0xabrarhussain
Copy link
Author

0xabrarhussain commented Oct 18, 2021

Earlier was only including ramdisk into my webpack.renderer.config, but including also into webpack.main.config get the following error:

✔ Checking your system
⠙ Preparing to Package Application for arch: x64⠋ Compiling Main Process Code⬡ webpack-plugin-ramdisk: Build being written [...]
✔ Compiling Main Process Code
⠋ Compiling Renderer Template⬡ webpack-plugin-ramdisk: Build being written [...]
✔ Compiling Renderer Template
✔ Preparing to Package Application for arch: x64
✔ Preparing native dependencies
⠋ Packaging Application
An unhandled rejection has occurred inside Forge:
Error: The main entry point to your app was not found. Make sure "/[...]/webpack/main" exists and does not get ignored by your ignore option
Electron Forge was terminated. Location:
{}
error Command failed with exit code 1.

@shellscape
Copy link
Owner

and seems that still gets filled up fully again

Sounds like you have a setting that's overriding the ramdisk plugin's behavior.

@0xabrarhussain
Copy link
Author

Any idea what that could be? If it's within the webpack config versus something inside of package.json. Have the following inside of webpack,

  plugins: [
    new WebpackPluginRamdisk(),
    new CopyPlugin({
      patterns: [
        {
          from: path.join('src', 'loading'),
          to: 'loading',
        },
      ],
    }),
    new webpack.DefinePlugin({
      'process.env.IS_DEVELOPMENT': JSON.stringify(process.env.IS_DEVELOPMENT),
    }),
  ],

Which doesn't seem like it'd be overriding behavior. So my guess would be it's something within Electron itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants