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

Trick View variable search causes large spike in cpu usage #1746

Closed
sharmeye opened this issue Jul 17, 2024 · 1 comment · Fixed by #1786
Closed

Trick View variable search causes large spike in cpu usage #1746

sharmeye opened this issue Jul 17, 2024 · 1 comment · Fixed by #1786
Assignees

Comments

@sharmeye
Copy link
Contributor

Search a variable in Trick View causes a large spike in CPU usage, oftentimes resulting in overruns for a realtime simulation. Multithreaded search function appears to be at least partially responsible.

In Searcher.java,

127 threads = Runtime.getRuntime().availableProcessors();
...
130 executorService = Executors.newFixedThreadPool(threads);

allocates a threadpool with a thread for each processor in the system and searches for the desired text in the sie list.

Realtime sims will often have overruns during this search

@sharmeye sharmeye self-assigned this Jul 18, 2024
@dbankieris
Copy link
Contributor

Multithreaded searching was added to address complaints about how long single-threaded searching took. While there are probably ways to improve the efficiency, it is likely to consume all of the resources available to it for a least part of the search unless you explicitly throttle it. Reducing the size of the thread pool (based on the total number of processors) would leave more processors available for other processes. However, there's no guarantee that other high-CPU processes won't consume those processors as well, and now you risk unnecessarily longer search times if those other processors sit idle. Generally, managing CPU allocation is the job of the operating system, not applications. If you don't want other applications impacting a sim, a more robust solution is to run that sim on an isolated core. Nevertheless, your "Greedy Search" feature is a reasonable compromise.

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

Successfully merging a pull request may close this issue.

2 participants