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

Demo application eats 13% CPU without doing anything... #4

Open
tapika opened this issue Dec 2, 2018 · 3 comments
Open

Demo application eats 13% CPU without doing anything... #4

tapika opened this issue Dec 2, 2018 · 3 comments

Comments

@tapika
Copy link

tapika commented Dec 2, 2018

Current API uses polling mechanism to poll updates, which eats CPU quite heavily.

Of course if you have 1 second polling mechanism like
https://github.com/RuntimeCompiledCPlusPlus/RuntimeCompiledCPlusPlus/wiki
does, then CPU usage cannot be seen, as it does not consume so much CPU as in SimpleDemo, but it consumes CPU still.

Would it be difficult to recode API to use threads instead ?

Also in newest c++ standards I've noticed that new class std::filesystem appeared, which deals with file system path/folders creation / directory / files enumeration - I think it's perfect from standardization perspective. Would like to see file watcher also standardized. Does makes any sense to switch api to lower case and move into std namespace, so it would be easier to integrate later on under the same umbrella ? :-)

@morgoth990
Copy link

The SimpleDemo usa a lot of cpu because of the while loop, profiling the performance the cpu time is irrelevant:
image

@tapika
Copy link
Author

tapika commented Apr 22, 2019

yes, but cpu usage can be minimized by adding additional sleep(50 ms) in that for loop, then it won't eat CPU so much.

@lucdewit2001
Copy link

lucdewit2001 commented Feb 6, 2021

yea i agree, you dont need to watch the file as fast as possible, you can limit it to cpu usage. This is what should be done

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

3 participants