Author Topic: Too slow cursor moving (Linux)  (Read 12680 times)

xintrea

  • Guest
Too slow cursor moving (Linux)
« on: October 24, 2007, 02:09:44 pm »
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?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Too slow cursor moving (Linux)
« Reply #1 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.codeblocks.org/index.php/topic,6538.0.html
http://forums.codeblocks.org/index.php/topic,2869.0.html

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Too slow cursor moving (Linux)
« Reply #2 on: October 24, 2007, 08:17:22 pm »
Quote
this 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

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Too slow cursor moving (Linux)
« Reply #3 on: October 24, 2007, 10:32:26 pm »
Quote
this 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

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.

... 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

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)


Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Too slow cursor moving (Linux)
« Reply #4 on: October 24, 2007, 10:50:09 pm »
Quote
My 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

  • Guest
Re: Too slow cursor moving (Linux)
« Reply #5 on: October 25, 2007, 12:57:47 am »
this is a known wxWidgets issue that affects some but not all linux installs.
see
http://forums.codeblocks.org/index.php/topic,6538.0.html
http://forums.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.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Too slow cursor moving (Linux)
« Reply #6 on: October 25, 2007, 01:46:18 am »
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.

xintrea

  • Guest
Re: Too slow cursor moving (Linux)
« Reply #7 on: October 25, 2007, 12:57:46 pm »
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

Code
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]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Too slow cursor moving (Linux)
« Reply #8 on: October 25, 2007, 01:10:25 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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

xintrea

  • Guest
Re: Too slow cursor moving (Linux)
« Reply #9 on: October 25, 2007, 01:30:23 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

  • Guest
Re: Too slow cursor moving (Linux)
« Reply #10 on: October 25, 2007, 02:23:06 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!

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Too slow cursor moving (Linux)
« Reply #11 on: October 25, 2007, 03:05:03 pm »
select "Notes" tab, open multiline textarea. In this textarea editing work excellent.
try profiling the notes editor and compare the timing

Offline eranif

  • Regular
  • ***
  • Posts: 256
Re: Too slow cursor moving (Linux)
« Reply #12 on: October 25, 2007, 03:07:18 pm »
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

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Too slow cursor moving (Linux)
« Reply #13 on: October 25, 2007, 04:00:37 pm »
xintrea: when you profiled did you have all plugins disabled?

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)

CABAListic

  • Guest
Re: Too slow cursor moving (Linux)
« Reply #14 on: November 19, 2007, 12:18:01 pm »
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.