Author Topic: High CPU usage  (Read 28664 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: High CPU usage
« Reply #45 on: September 15, 2005, 11:52:55 pm »
Sound like the right way to go about it (OnIdle + OnTerminate).
OnTimer + OnTerminate? Else, we can leave it as it was before. :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline grv575

  • Official tester
  • Regular
  • ***
  • Posts: 381
Re: High CPU usage
« Reply #46 on: September 16, 2005, 05:19:55 am »
Heh.  yes that's what I meant.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: High CPU usage
« Reply #47 on: November 22, 2007, 03:07:15 pm »
Coming back to the old topic of high CPU consumption (hopefully I picked the right thread):
I just found something that I wasn't sure what it is needed for, commented it out, and surprisingly found my old suspicions about update events confirmed.



This image shows
(1) typing legible text at my normal typing speed
(2) typing illegible text like aflkdjflfkdjfalsdfsdafs at a significantly higher speed
(3) permanently holding down the right arrow key
(4) changing text selection using the mouse

The upper half of the image is Code::Blocks HEAD, the lower half is Code::Blocks HEAD with lines 720-722 in sdk/editormanager.cpp sdk/cbeditor.cpp commented out. The graph needs no further explanation, I think.

Now, it would be interesting to see if this can fix the "100% CPU" problem and the "cpu fan spinning up on my notebook when I type" problem for the people affected.
« Last Edit: November 22, 2007, 03:11:03 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: High CPU usage
« Reply #48 on: November 22, 2007, 03:22:41 pm »
nice! I suspect this may also help those linux users experiencing editor slowness issues...

Offline artoj

  • Almost regular
  • **
  • Posts: 206
  • Location: Supporting my team
    • http://ajonsson.kapsi.fi/
Re: High CPU usage
« Reply #49 on: November 22, 2007, 03:29:46 pm »
Great! I'll test this on my laptop.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: High CPU usage
« Reply #50 on: November 22, 2007, 03:31:51 pm »
Real performance killer has been identified and committed in rev4660.
Please test and report back :).
Be patient!
This bug will be fixed soon...

Offline artoj

  • Almost regular
  • **
  • Posts: 206
  • Location: Supporting my team
    • http://ajonsson.kapsi.fi/
Re: High CPU usage
« Reply #51 on: November 22, 2007, 04:13:57 pm »
Revision 4660
Ubuntu Feisty
wxGTK 2.8.6

Pentium M 1.73GHz (single core)

Test results (CPU usage from "top" command):

    typing normal text at normal speed: 10 %
    typing random text: 17 %
    permanently holding the down key: 56 %
    changing selection with mouse: 50 %

EDIT: These are the results that I got (almost) exactly year ago.

EDIT: And test results using Thomas' patch w/ earlier revision than 4660:

    typing normal text at normal speed: 7 %
    typing random text: 12%
    permanently holding the down key: 60%
    changing selection with mouse: 50%

These are not the average but the highest I got. I don't know if these test results make any sense. Interesting thing is that that when I now look at the "top" program I can see Code::Blocks consuming around 2 % of the CPU all the time even when I'm not using that machine.
« Last Edit: November 22, 2007, 05:12:47 pm by artoj »

Offline Abscissa

  • Single posting newcomer
  • *
  • Posts: 6
Re: High CPU usage
« Reply #52 on: May 30, 2008, 12:29:27 am »
I'm having a problem with high CPU usage too, on the latest version:

CPU/Mem usages when the porgram has a simple project loaded, is doing nothing, and has been doing nothing for a few minutes:

CodeBlocks v8.02: 18%-22%, ~5MB

For comparison:
Visual C# Express 2008: 0%-1%, ~80MB
Eclipse v3.3.2: 0%-1%, ~100MB
Flash MX Pro 2004: 0%-1%, ~42MB
Firefox v2.0.0.13: 0%-1%, ~50MB

My Machine:
WinXP Pro SP2
Celeron 1.7GHz
1GB RAM

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: High CPU usage
« Reply #53 on: June 02, 2008, 09:56:33 am »
I'm having a problem with high CPU usage too, on the latest version:
You could try by starting to deactivate (contrib...) plugins. Probably you have a plugin installed that takes a lot of CPU usage for some obscure reason. I'd say for the most of us (including me) C::B takes nearly no CPU power.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Abscissa

  • Single posting newcomer
  • *
  • Posts: 6
Re: High CPU usage
« Reply #54 on: June 07, 2008, 11:25:20 pm »
I'm having a problem with high CPU usage too, on the latest version:
You could try by starting to deactivate (contrib...) plugins. Probably you have a plugin installed that takes a lot of CPU usage for some obscure reason. I'd say for the most of us (including me) C::B takes nearly no CPU power.

I haven't installed any plugins that didn't come with codeblocks (although I did choose the "Full" install, as I always do). I tested them all and it doesn't look like there is any single plugin that's causing the problem. Rather, the effect seems to be cumulative, with a few of them weighted more havily than the others. Here are my testing results:

In all tests, IDE had a project loaded but was idle and mouse was not moving (except where otherwise noted).

All plugins disabled: 0%-2% (Never spikes above 2%)
All plugins disabled, moving mouse around: 6%-16%

One Plugin Only:
(Note, these are ALL the pluging I have installed, and all of them came pre-installed and pre-enabled with codeblocks v8.02)

Debugger: 1%-5%
Code Completion: 0%-4%
Compiler: 0%-4%

ThreadSearch: 0%-3%, spikes at 4%
DragScroll: 0%-3%
Keyboard Shortcuts: 0%-3%
AutoVersioning: 0%-3%
BrowseTracker: 0%-3%
Code Snippets: 0%-3%
Files Extention Handler: 0%-3%

Dev-C++ DevPack updater/installer: 0%-2%, spikes at 4%
Library Finder: 0%-2%, spikes at 4%
Source Exporter: 0%-2%, spikes at 4%

Code Profiler: 0%-2%, spikes at 3%
Foreign Project Importer: 0%-2%, spikes at 3%
Help plugin: 0%-2%, spikes at 3%
Open Files List: 0%-2%, spikes at 3%
ToDo List: 0%-2%, spikes at 3%
wxSmith MIME Plugin: 0%-2%, spikes at 3%

XP Look and Feel: 0%-2%
Source Code Formatter (AStyle): 0%-2%
AutoSave: 0%-2%
BYO Games: 0%-2%
ClassWizard: 0%-2%
Code Statistics: 0%-2%
Copy strings to clipboard: 0%-2%
Environment Variables: 0%-2%
Koders Query: 0%-2%
Regular Expressions Testbed: 0%-2%
Scripted Wizard: 0%-2%
Symbol Table Plugin: 0%-2%
wxSmith: 0%-2%
wxSmith Contrib Items: 0%-2%

All 3 wxSmith Plugins: 0%-2%, spikes at 3%

Five Plugins enabled at once:
Debugger, Code Completion, Compiler, ThreadSearch, and DragScroll: 5%-9%, spikes up to 12%
AutoSave, BYO Games, Code Statistics, ClassWizard, and Koders Query: 0%-3%

Everything except Debugger, Code Completion, Compiler, ThreadSearch, and DragScroll: 3%-7%, spikes down to 1% and up to 9%

Everything: 16%-23%