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

Electron 7 #32

Closed
demosjarco opened this issue Oct 26, 2019 · 12 comments
Closed

Electron 7 #32

demosjarco opened this issue Oct 26, 2019 · 12 comments
Labels
question Further information is requested

Comments

@demosjarco
Copy link

(I know the readme says electron 4-6) but in electron 7, cpu usage spikes insanely.

Electron version Pure Electron Electronmon
7.0 ~5% ~90%
6.1.2 ~10% ~20%

I like electronmon during development because it helps so much to have auto re-launch but I would like to use the same version of electron during dev as in testing and production.

@catdad
Copy link
Owner

catdad commented Oct 26, 2019

Are you by chance on a Mac? Also, which version of electronmon are you using?

Electronmon uses chokidar, which has this fun problem where when fsevents is not available on a Mac for any reason, it will fall back to polling when watching files, which is super expensive.

@catdad
Copy link
Owner

catdad commented Oct 26, 2019

Hmm... I took a look at your repos and the only Electron app I found was overviewer-configurator (you could of course also be working on closed-source projects, so forgive me if I have made a hasty assumption... I am only trying to be proactive). That project is unfortunately using electromon and not electronmon... that seems like an easy typo and I am surprised that npm's typo-squatting let me publish my package -- I didn't know that package existed until just now, the close naming is quite unfortunate. Anyway, I cannot provide support for that package, as I am not affiliated with it in any way (but if you are in fact using electronmon on another project, I'm happy to help).

However, since it claims to do exactly the same thing as my package in the same way (which is I am guessing why you may have been looking at my documentation but using the different package and everything still worked), I decided to check it out. For me on Windows, that package is always using ~25% CPU on top of my app itself, and it also never fully finishes watching files (do you also have really slow boot times with that package?), even on .

I am happy to report that if you intended to use my package, you should check it out now! To my knowledge (and I use it across Windows, MacOS, and Linux) there is generally no added CPU overhead on top of what the Electron app itself uses, and there is negligible start time overhead (like... maybe a couple hundred milliseconds tops).

@demosjarco
Copy link
Author

yea I just realized that myself too. I have switched to you package instead (that's what I wanted in the first place but I never noticed my typo until now), but I'm in the process of doing some other visual studio file stuff so I haven't had a chance to test it yet.

@catdad
Copy link
Owner

catdad commented Oct 26, 2019

No problem. I'll keep this open for a bit, so do let me know if you run into any issue with it. In the meantime, I have added Electron 7 to my test matrix and am finding that it works properly so far.

@catdad catdad added the question Further information is requested label Oct 26, 2019
@demosjarco
Copy link
Author

demosjarco commented Oct 26, 2019

Yea, your package is so much better.
With electronmon and electron 7:
image
Pure electron 7:
image
Thanks for the help, I'll check my other electron projects and make sure I fix the typo there too.

@demosjarco
Copy link
Author

demosjarco commented Oct 26, 2019

Some further testing, when it reloads due to file change, electron will close and re-open. However it is still running the same code as before.

Example: I run electronmon .. I have a main.js that imports file2.js (using require()). I make a change in file2.js. electronmon detects the change and reloads the electron app. But the app is still running the old code from file2.js that was there when I originally opened electronmon.

Running electronmon 0.5.1 on nodejs 12.13.0

@demosjarco demosjarco reopened this Oct 26, 2019
@catdad
Copy link
Owner

catdad commented Oct 26, 2019

Hmm... interesting. Do you have a project that is able to reproduce this? I didn't run into this issue on my own projects, or just now when I grabbed a version of overviewer-configurator. Maybe I didn't test changing the correct file? Having a repro case would be really useful.

@demosjarco
Copy link
Author

If I add a console.log that shows 2 of the json files I'm downloading, but have 1 on at a time, you can see that it does restart the script but still runs the old code.

What I did: In the overviewer-configurator project, go to nodejs > overviewerVersions.js. In the file right after the else on line 82, do a console.log(JSON.parse(body2));. Then right after the else on line 111, do console.log(JSON.parse(body3)); but leave it commented out. Run npm run dev (runs electronmon). Once it opens, go and comment out the first console.log and uncomment the second.
Note: There is no other console.log in that whole file so all the console output is what you are adding.

screen rec

@catdad
Copy link
Owner

catdad commented Oct 27, 2019

Hmm.... I must be missing something from your setup. When I ran it, I got this:

image

From your video though, I see this in your log:

image

Notice how my image detects the file as a "main file" while yours detects it as a "renderer file"?

I also see that in Visual Studio, the path to your project is this:

image

However, in your command prompt, the path was this:

image

Why are these paths different? It looks like you changed a file in one folder and expected a file in a different folder to have changed? Is there something non-obvious about your environment that I am missing?

@catdad
Copy link
Owner

catdad commented Oct 27, 2019

I made the simplest guess -- that you have moved your user folder to a separate drive and linked it to the regular user folder location -- and can reproduce the issue. I added #33 to add support for linked directories. It should be a trivial fix.

If you want to check out an early version, you can try it now with this:

npm i electronmon@https://github.com/catdad/electronmon/tarball/c647f202c58949b874d7108a4fe88ec2e0e04751

I have to figure out how to test this on all operating systems before I can publish it though.

@demosjarco
Copy link
Author

I don't know why it's recognizing it as a render file. Everything in the nodejs folder is main process. The other folders are render process. Yea, the folder is actually stored on E: but hardlinked to ~/GitHub (I have a separate hard drive for all my coding since my boot SSD doesn't have enough space) since command prompt opens to the user directory by default so it's faster/easier to cd there

@catdad
Copy link
Owner

catdad commented Oct 27, 2019

I just pushed 0.6.0 which fixes the issue with linked locations. See #33 if you are interested to know more.

@catdad catdad closed this as completed Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants