News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Too slow cursor moving (Linux)

Started by xintrea, October 24, 2007, 02:09:44 PM

Previous topic - Next topic

xintrea

Hi all!

I install Code::Blocks v.4503 under Ubuntu 7.04. This IDE very nice, but i don`t work with this. Reason - too slow cursor moving in editor. I have P 2.2 Mhz processor, and cursor newer brake even in Java application. But in codeblocks cursor moving very slow.

If push cursor key (lefr/right), then cursor jumping a few symbol (or 3-5 line if push up/down).

If fast tying any word, then (about half-second) see as show letters in editor.

If selected text with key or mouse, this select area "lashing" to many lines, and then necessary corrected select area in low speed.

This is serious obstacle for use this IDE.


I try turn off folding and syntax highliting (syntax highliting C/C++ lang i turn off with change filemask string in setting from "*.c,*.cpp,*.cc,*.cxx,*.h,*.hpp,*.hh,*.hxx,*.inl" to "*.ijk"). But cursor moving already slow. In program top, i see 60-80% use processor time if moving cursor in Code::Blocks.

How accelerate cursor running?

dmoore

Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

eranif

Quotethis is a known wxWidgets issue that affects some but not all linux installs.
I really disagree with you on this one.
IMO, it has nothing to do with wxWidgets, but to the specific machine/C::B code.
I am running C::B on the Ubuntu as well (7.04) works nice, along with other applications that are using wxWidgets + wxScintilla all are running fine.

Eran

dmoore

Quote from: eranif on October 24, 2007, 08:17:22 PM
Quotethis is a known wxWidgets issue that affects some but not all linux installs.
I really disagree with you on this one.
IMO, it has nothing to do with wxWidgets, but to the specific machine/C::B code.
I am running C::B on the Ubuntu as well (7.04) works nice, along with other applications that are using wxWidgets + wxScintilla all are running fine.

the fact that you have C::B running fine on Ubuntu does not prove the claim that this is not a wxWidgets issue. As I said in the first post, the issue only seems to affect some installations.

I'm kinda surprised that you would be disagree so strongly Eran, given that you participated in both of those threads

Quote from: rotalever on July 27, 2007, 12:03:02 PM
Ok, the problem has nothing todo with CB. I tested some examples from the wxwidget webpage. The HTML-Viewer and the textboxwidget are very slow, too. It is the same lag as in CB if you try to select some text.

Compiling wxwidgets on my own doesnt change anything.

Quote from: rotalever on July 31, 2007, 08:13:12 PM
... I asked this in the wxWidgets forums and someone said:
"I don't think anyone knows why, but wx apps using gtk2 do take a long time to render. There's no 'quick' fix for this. "

even you said

Quote from: eranif on September 24, 2006, 10:42:19 AM
I forgot to post it, but I already solved my problem. My problem was excessive calling to TextWidth() function which caused huge performance degradation.

This slowed the typing in the editor only Linux machines ( I tried it on FC4/5 and Ubuntu) but did not cause any slow effects on windows.

if seemingly innocuous wxWidgets functions run at wildly different speeds depending on OS, I call that an issue... (not that it is necessarily the specific problem in this particular case)

Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

eranif

QuoteMy problem was excessive calling to TextWidth() function which caused huge performance degradation.
TextWidth was not the underlying problem, but functions inside cairo caused it (AFAIR, it is font calculation function) . TextWidth is just a wrapper on top of it.

My original problem was, that I was using an editor which increased its left margin width dynamically (it called TextWidth() to calculate the margin width after every type, dont ask me why  :D).

Using '-pg' with 'g++' followed by running gprof pin pointed me to the problem. Eliminating this width calculation, restored the editing to normal / fast mode.

I never claimed it is wx problem for my case.
I do suggest that the OP should try and install another wx based editor on its machine and compare the editing speed.

Eran

xintrea

Quote from: dmoore on October 24, 2007, 06:05:51 PM
this is a known wxWidgets issue that affects some but not all linux installs.
see
http://forums.next.codeblocks.org/index.php/topic,6538.0.html
http://forums.next.codeblocks.org/index.php/topic,2869.0.html

In this themes i dont find guaranteed solving my problem. This problem exists from septmber 2006, and i had hoped that this bug is fixing...

After read foregoing threads, i try check, how frequency calling methods Editor::TextWidth() and wxScintilla::TextWidth()? I add printf() command in this methods. And i see, that methods dont calling if move cursor or select text with keyboard or mouse. This methods calling once in first open window, once if inserting text (ctrl+v), once if add new line (push Enter), and this is all. Trouble is not in this function.

Tomorrow try profile codeblocks.

dmoore

Quote
In this themes i dont find guaranteed solving my problem. This problem exists from septmber 2006, and i had hoped that this bug is fixing...

unfortunately, most people don't have the pleasure of experiencing this bug, just a "lucky" few :) so there have been few opportunities to do the needed profiling. if you can do some profiling that will definitely help (especially if you have experience with profiling in linux).

Quote
After read foregoing threads, i try check, how frequency calling methods Editor::TextWidth() and wxScintilla::TextWidth()? I add printf() command in this methods. And i see, that methods dont calling if move cursor or select text with keyboard or mouse. This methods calling once in first open window, once if inserting text (ctrl+v), once if add new line (push Enter), and this is all. Trouble is not in this function.

yes, I think that avenue has been explored without succcess.
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

xintrea

My report about profile codeblocks.

Before, i running make clean, next running configure with flags

Quote./configure CXXFLAGS=-pg CFLAGS=-pg

Next running make and make install (as root).

After this manipulation, i type command codeblocks in my work directory, check data and time of compilation in "About" window, to be sure that codeblocks contain changes for profile. About one minut i simulated violent activies in the editor - move cursor, copy, paste, etc.. Then closed codeblocks.

In work directory i see new file - gmon.out. Reduced output of command gprof codeblocks gmon.out

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
time   seconds   seconds    calls  Ts/call  Ts/call  name
33.33      0.03     0.03                             wxWindowBase::IsShown() const
27.78      0.06     0.03                             CodeBlocksApp::GetEventHashTable() const
11.11      0.07     0.01                             wxWindowBase::GetBestVirtualSize() const
  5.56      0.07     0.01                             wxWindowBase::GetValidator()
  5.56      0.08     0.01                             wxMenuItemList::CreateNode(wxNodeBase*, wxNodeBase*, void*, wxListKey const&)
  5.56      0.08     0.01                             wxWindowBase::AcceptsFocusFromKeyboard() const
  5.56      0.09     0.01                             CodeBlocksApp::GetEventTable() const
  5.56      0.09     0.01                             wxMenuItemList::Find(wxListKey const&) const
  0.00      0.09     0.00    46629     0.00     0.00  data_start
  0.00      0.09     0.00     1486     0.00     0.00  wxFrameBase::GetMenuBar() const
  0.00      0.09     0.00      313     0.00     0.00  MainFrame::DoUpdateStatusBar()
  0.00      0.09     0.00      313     0.00     0.00  wxFrameBase::GetStatusBar() const
  0.00      0.09     0.00      310     0.00     0.00  EditorBase::GetFilename() const
  0.00      0.09     0.00      303     0.00     0.00  MainFrame::OnEditorUpdateUI(CodeBlocksEvent&)
  0.00      0.09     0.00      100     0.00     0.00  EditorBase::GetModified() const
  0.00      0.09     0.00       95     0.00     0.00  EditorBase::IsReadOnly() const
  0.00      0.09     0.00       95     0.00     0.00  EditorBase::HasSelection() const
  0.00      0.09     0.00       95     0.00     0.00  EditorBase::CanRedo() const
  0.00      0.09     0.00       95     0.00     0.00  EditorBase::CanUndo() const
  0.00      0.09     0.00       95     0.00     0.00  EditorBase::CanPaste() const
  0.00      0.09     0.00       18     0.00     0.00  MainFrame::DoUpdateLayout()
  0.00      0.09     0.00       16     0.00     0.00  MainFrame::DoUpdateAppTitle()
  0.00      0.09     0.00       15     0.00     0.00  MainFrame::AddPluginInMenus(wxMenu*, cbPlugin*, void (wxObject::*)(wxEvent&), int, bool)
  0.00      0.09     0.00       10     0.00     0.00  MainFrame::DoAddPlugin(cbPlugin*)
  0.00      0.09     0.00       10     0.00     0.00  MainFrame::OnPluginLoaded(CodeBlocksEvent&)
  0.00      0.09     0.00       10     0.00     0.00  MainFrame::AddPluginInSettingsMenu(cbPlugin*)
  0.00      0.09     0.00       10     0.00     0.00  MainFrame::AddPluginInHelpPluginsMenu(cbPlugin*)
  0.00      0.09     0.00        9     0.00     0.00  MainFrame::OnEditorActivated(CodeBlocksEvent&)
  0.00      0.09     0.00        9     0.00     0.00  MainFrame::OnRequestDockWindow(CodeBlocksDockEvent&)
  0.00      0.09     0.00        8     0.00     0.00  MainFrame::DoAddPluginToolbar(cbPlugin*)
  0.00      0.09     0.00        5     0.00     0.00  CodeBlocksEvent::~CodeBlocksEvent()
  0.00      0.09     0.00        4     0.00     0.00  MainFrame::DoFixToolbarsLayout()
  0.00      0.09     0.00        3     0.00     0.00  LayoutViewsMap::operator[](wxString const&)
  0.00      0.09     0.00        3     0.00     0.00  MainFrame::ShowHideStartPage(bool)
  0.00      0.09     0.00        3     0.00     0.00  MainFrame::DoUpdateEditorStyle(wxFlatNotebook*, wxString const&, long)
  0.00      0.09     0.00        2     0.00     0.00  CodeBlocksApp::ParseCmdLine(MainFrame*)
  0.00      0.09     0.00        2     0.00     0.00  MainFrame::SaveViewLayout(wxString const&, wxString const&, bool)
  0.00      0.09     0.00        2     0.00     0.00  MainFrame::OnEditorModified(CodeBlocksEvent&)
  0.00      0.09     0.00        2     0.00     0.00  MainFrame::AddPluginInPluginsMenu(cbPlugin*)
  0.00      0.09     0.00        2     0.00     0.00  MainFrame::TerminateRecentFilesHistory()
  0.00      0.09     0.00        2     0.00     0.00  MainFrame::DoCheckCurrentLayoutForChanges(bool)
  0.00      0.09     0.00        2     0.00     0.00  std::_Rb_tree<wxString, wxString, std::_Identity<wxString>, std::less<wxString>, std::allocator<wxString> >::lower_bound(wxString const&)
  0.00      0.09     0.00        2     0.00     0.00  std::_Rb_tree<wxString, wxString, std::_Identity<wxString>, std::less<wxString>, std::allocator<wxString> >::upper_bound(wxString const&)
  0.00      0.09     0.00        2     0.00     0.00  std::_Rb_tree<wxString, wxString, std::_Identity<wxString>, std::less<wxString>, std::allocator<wxString> >::erase(std::_Rb_tree_iterator<wxString>, std::_Rb_tree_iterator<wxString>)
  0.00      0.09     0.00        2     0.00     0.00  std::_Rb_tree<wxString, wxString, std::_Identity<wxString>, std::less<wxString>, std::allocator<wxString> >::_M_erase(std::_Rb_tree_node<wxString>*)
  0.00      0.09     0.00        1     0.00     0.00  global constructors keyed to _ZN10appglobals9AppVendorE


Full output in attach of this message.

What can says, looking at this data?

[attachment deleted by admin]

MortenMacFly

Quote from: xintrea on October 25, 2007, 12:57:46 PM
What can says, looking at this data?
It says everything is fine. We have an event based UI application here.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

xintrea

Quote from: eranif on October 24, 2007, 10:50:09 PM
I do suggest that the OP should try and install another wx based editor on its machine and compare the editing speed.

If click left button on project in codeblocks, and select "Notes" tab, open multiline textarea. In this textarea editing work excellent. Cursor running is fast, select text with key or mouse carried without delays.

Editing work slow only in code editor.

xintrea

Quote from: MortenMacFly on October 25, 2007, 01:10:25 PM
Quote from: xintrea on October 25, 2007, 12:57:46 PM
What can says, looking at this data?
It says everything is fine. We have an event based UI application here.

But editing working slow..

- Doctor, I was ill!
- It just seems you. You are well!

dmoore

Quote from: xintrea on October 25, 2007, 01:30:23 PM
select "Notes" tab, open multiline textarea. In this textarea editing work excellent.
try profiling the notes editor and compare the timing
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

eranif

Quick shot in the dark:

Does line wrapping is enabled? (long lines diplays on a multiple lines, without horizontal scrollbar)

If it does, disable it and try typing again  :D

EDIT:
About the note editor:
Is it wxScintilla based? if not, then there is nothing to compare between the two.

Eran

dmoore

xintrea: when you profiled did you have all plugins disabled?

Quote from: eranif on October 25, 2007, 03:07:18 PM
About the note editor:
Is it wxScintilla based? if not, then there is nothing to compare between the two.

As noted in quotes above, poster rotalever did have some troubles with other non-scintilla rich text controls, so I thought this might be relevant for comparison. i.e. what does "normal" event activity look like

xintrea: you could also try testing and profiling scite (although it isn't a wxwidgets app)
Python plugins: [url="https://github.com/spillz/codeblocks-python"]https://github.com/spillz/codeblocks-python[/url]
Code::Blocks Daily Builds -- Ubuntu PPA: [url="https://launchpad.net/~damien-moore/+archive/codeblocks"]https://launchpad.net/~damien-moore/+archive/codeblocks[/url]

CABAListic

I'm also one of those poor guys experiencing a lagging editor component. However, I might have some new insight.

On my two desktop computers I have installed Kubuntu 7.04, and both are experiencing the problem. Recently, though, I installed Ubuntu 7.10 on my laptop, and it does *not* suffer from this issue. So basically there are three major differences between my desktop PCs and the laptop:
1. Desktops are using Kubuntu (KDE), the laptop is using Ubuntu (Gnome).
2. Desktops are at version 7.04, laptop at 7.10.
3. Desktops are AMD systems, the laptop is Intel.

So for a quick test I did the following on my desktop: xinit codeblocks -- :1
So I get a second X server running only codeblocks, no KDE or whatsoever, and guess what? The issue went away. On that second pure X server the editor component runs as I would expect it to, no lag when moving cursor, selecting text or whatever.
I'm not saying the problem is with KDE, but obviously something in the background does interfere with CodeBlocks on the same X server. As of yet I don't have a clue what it is. Maybe others experiencing the problem could also try the xinit thing, so we can get this tracked down finally.