U++ framework
Do not panic. Ask here before giving up.

Home » U++ TheIDE » U++ TheIDE: CodeEditor, Assist++, Topic++ » A little proposal on code analysis
A little proposal on code analysis [message #21041] Tue, 28 April 2009 10:40 Go to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

It looks like code analysis (or some kind of processing) is made each time key is pressed in the code editor. This makes TheIDE lagging on slower machines (even on my /rather old/ AMD 2GHz) when I type quickly enough. It looks like this: when I type a number of symbols quickly, they are not shown. They are drawn (all at once) after a period of about 0.5 seconds after last symbol was typed. This makes little discomfort as you can`t immediately observe text typed, and one have to wait for this lag each time he types anything.
I suppose this lag is caused by TheIDE calls code processing every time user changes the text. My proposal is to call code processing after symbols were drawn in the window and also if I type symbols one by one without stop, the code processing should be called after some timeout to minimize it`s call count.

[Updated on: Tue, 28 April 2009 10:42]

Report message to a moderator

Re: A little proposal on code analysis [message #21087 is a reply to message #21041] Sun, 03 May 2009 17:27 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

:up:

Latest TheIDE version 902r186 : the same problem with lags.
Re: A little proposal on code analysis [message #21090 is a reply to message #21087] Sun, 03 May 2009 17:48 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

I may create and upload screenshot-video if it`s needed. But I suppose many more people (with CPUs dating < 2003-2005) has the same problem too.

[Updated on: Sun, 03 May 2009 17:49]

Report message to a moderator

Re: A little proposal on code analysis [message #21091 is a reply to message #21090] Sun, 03 May 2009 18:47 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
What OS?

Screenshot might help.

Mirek
Re: A little proposal on code analysis [message #21092 is a reply to message #21091] Sun, 03 May 2009 18:53 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

luzr wrote on Sun, 03 May 2009 20:47

What OS?

Screenshot might help.

Mirek

Windows XP, SP2.

OK, I`ll make video ASAP. Single screenshot won`t help as it can`t show the lag itself.
Re: A little proposal on code analysis [message #21143 is a reply to message #21092] Tue, 05 May 2009 09:19 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

http://www.youtube.com/watch?v=SyIZ8UeybSQ

[Updated on: Tue, 05 May 2009 09:20]

Report message to a moderator

Re: A little proposal on code analysis [message #21199 is a reply to message #21143] Sat, 09 May 2009 08:49 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1428
Registered: September 2007
Ultimate Contributor
I can confirm that for SVN 1113, TheIDE has serious lag when typing. It does no appear for small projects. Try loading "ide".

Windows XP, MSC8, Core 2 Duo E6550, GeForce 8800 GT, 2GB RAM
Re: A little proposal on code analysis [message #21208 is a reply to message #21199] Sat, 09 May 2009 17:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
OK, looks like having super fast machine is not always an advantage...

Anyway, I believe I have found a culprit. Please check this fix:

void Ide::InsertMenu(Bar& bar)
{
	if(bar.IsScanKeys())
		return;
	bar.Add("Insert color..", THISBACK(InsertColor));
	int pi = GetPackageIndex();
	const Workspace& wspc = IdeWorkspace();
	if(pi >= 0 && pi < wspc.GetCount()) {
		String pn = wspc[pi];
		const Package& p = wspc.GetPackage(pi);
		int n = 0;
		for(int i = 0; i < p.GetCount() && n < 12; i++) {
			String fn = p[i];
			String ext = ToLower(GetFileExt(fn));
			String pp = pn + '/' + fn;
			if(ext == ".lay") {
				bar.Add(fn + " include", THISBACK1(InsertLay, pp));
				n++;
			}
			if(ext == ".iml") {
				String c = GetFileTitle(fn);
				c.Set(0, ToUpper(c[0]));
				bar.Add(fn + " include", THISBACK2(InsertIml, pp, c.EndsWith("Img") ? c : c + "Img"));
				n++;
			}
			if(ext == ".tpp") {
				bar.Add(fn + " include", THISBACK1(InsertTpp, pp));
				n++;
			}
		}
	}
}



Mirek
Re: A little proposal on code analysis [message #21215 is a reply to message #21208] Sat, 09 May 2009 23:42 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Regretfully it didn`t help. Code editing still lags with this update.
One of the tests: while in code editor, make new line with Enter, write //, then press '=' key and do not release it. A sequence of '=' symbols will be added, but not displayed (this is TheIDE lag), wait a while, then release the key, then all the symbols are being displayed, all at once. Correct behaviour should be displaying each symbol immediately after it was added.

test config: AMD Athlon 2.1 GHz, WinXP SP2, SVN 1151 + patch, TheIDE compiled with MSC9 (GUI MT).

[Updated on: Sat, 09 May 2009 23:58]

Report message to a moderator

Re: A little proposal on code analysis [message #21218 is a reply to message #21215] Sun, 10 May 2009 08:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Sat, 09 May 2009 17:42

Regretfully it didn`t help. Code editing still lags with this update.
One of the tests: while in code editor, make new line with Enter, write //, then press '=' key and do not release it. A sequence of '=' symbols will be added, but not displayed (this is TheIDE lag), wait a while, then release the key, then all the symbols are being displayed, all at once. Correct behaviour should be displaying each symbol immediately after it was added.

test config: AMD Athlon 2.1 GHz, WinXP SP2, SVN 1151 + patch, TheIDE compiled with MSC9 (GUI MT).


Well, for record, displaying is not necessarry wrong behaviour, U++ (and most othre GUIs) are designed this way since first MacOS.

The idea is that screen repainting is as lazy as possible - it is done only is no other input event is in the queue for processing. Better lag repainting than miss keystroke, right?

Anyway, if you still observe lag, I will have to dig deeper I guess. There definitely should not be any lag in this case.

Mirek
Re: A little proposal on code analysis [message #21220 is a reply to message #21218] Sun, 10 May 2009 08:59 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

luzr wrote on Sun, 10 May 2009 10:39

Well, for record, displaying is not necessarry wrong behaviour, U++ (and most othre GUIs) are designed this way since first MacOS.
I agree with this approach in general but in this case it is important as U++ is positioned as agile and very effective development platform. Any new members will test U++ by using TheIDE. And making it lag is not the best thing for U++ reputation. We already do have Qt which (since version 4) became monstrouse and lagging. U++ could fit into the market of more effective frameworks but this presumes i.e. effectiveness of TheIDE (if development IDE breaks, how could I possible wite effective programs with this framework - one will ask himself).

IMO the most lazy thing should be could analysis.
Less lazy is GUI changing (I mean status bar, menu, etc.).
But keyboard/mouse respond is to be immediate - it is vital consumer appeal and a "face" of U++, especially for newcomers.

P.S. Even latest M$ Studio 2009` code editor doesn`t lag on my (and even older) PC`s. Good for Balmer. )

[Updated on: Sun, 10 May 2009 09:10]

Report message to a moderator

Re: A little proposal on code analysis [message #21223 is a reply to message #21208] Sun, 10 May 2009 09:29 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1428
Registered: September 2007
Ultimate Contributor
Yes, no change here either.

luzr wrote on Sat, 09 May 2009 18:39

OK, looks like having super fast machine is not always an advantage...



I consider my machine specs quite good for a desktop development machine. It is not an airplane or anything, but it was high end when I bought it and relatively expensive. I wouldn't consider compiling C++ on anything less. Yet I still have this delay which makes editing almost impossible.

What are you're hardware specs Mirek?

And could some people with high end machines check it out? This issue is hard to observe because I suspect only a handful of people keep their sources synced with latest SVN all the times.
Re: A little proposal on code analysis [message #21224 is a reply to message #21223] Sun, 10 May 2009 10:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Well, cool down, there is no fundamental reason for this to be slow.

If it (still) lags, there is some problem, most likely in theide code, that has to be fixed.

I am now sitting at 2Ghz/2GB Core 2 notebook, so no speedster at all, although probably bit faster than 2.1 Ghz Athlon. (My desktop is 3.2Ghz Core 2 Quad, which is not the i7, but it is pretty to notice any lag...)

Well, on this notebook, I have noticed faint lag when autorepeat. Above patch fixed it completely. (Makes me even wonder if you have applied patch correctly.. which is more than likely, I know).

I guess I will have to finally setup my "slow machine" (I have some nice old Celeron 400 ready Smile for such occasions....

Mirek
Re: A little proposal on code analysis [message #21243 is a reply to message #21224] Sun, 10 May 2009 19:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
OK, performed tests on Sempron 1.6Ghz, 512MB RAM, XP, HD 5200rpm (quite slow machine IMO).

Without the patch, lag was quite noticeable.

Anyway, after patching, there still is some lag if I type really really fast (much faster than "default" autorepeat), but it is definitely better.

So I wanted to ask - did it got any better for you with patch? Smile

Mirek
Re: A little proposal on code analysis [message #21247 is a reply to message #21243] Sun, 10 May 2009 20:14 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
After a bit of thinking, I suggest that you would test plain LineEdit and then CodeEditor (yes, it can be used as normal widget without theide).

Something like:

#include <CodeEditor/CodeEditor.h>

using namespace Upp;

GUI_APP_MAIN {
	TopWindow win;
	LineEdit edit;
//	CodeEditor edit; //2nd test
//	edit.Highlight(CodeEditor::HIGHLIGHT_CPP);
	win.Add(edit.SizePos());
	win.Run();
}


(Add CodeEditor package...)

Try and report the lag....

Mirek
Re: A little proposal on code analysis [message #21250 is a reply to message #21247] Sun, 10 May 2009 21:28 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Tried this test. Everything is OK for both LineEdit and CodeEditor widgets: no lags (even for rather big files), even DnD duplication worked correctly all the time.
Re: A little proposal on code analysis [message #21254 is a reply to message #21250] Sun, 10 May 2009 22:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Sun, 10 May 2009 15:28

Tried this test. Everything is OK for both LineEdit and CodeEditor widgets: no lags (even for rather big files), even DnD duplication worked correctly all the time.


Thank, that means we have to dig in theide Smile

Has the patch improved situation? (It did for me). Or there is no noticeable difference?

(Now I am thinking, and I am really sorry to ask this question: Have you rebuild theide? OK, ok, just needed to check Smile

Mirek
Re: A little proposal on code analysis [message #21256 is a reply to message #21254] Sun, 10 May 2009 23:18 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

1. Yes, patch decreased the lags. I just need some time to test it in a more careful way. But at first glance, yes, there is difference.
Writing program text seems much better while autorepeat is still drawn only after I release the key (but as I told - it`s need to be tested better).

2. I`ve just re-checked: yes, TheIDE is from SVN, patched and recompiled and is certainly executed (not the old one).

UPDATE: No, sorry, the lag is still there even w/o autorepeat. Maybe a little smaller, but yet annoying.

And again, thank you for quick responses and great support!

[Updated on: Sun, 10 May 2009 23:31]

Report message to a moderator

Re: A little proposal on code analysis [message #21258 is a reply to message #21256] Mon, 11 May 2009 00:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Sun, 10 May 2009 17:18


And again, thank you for quick responses and great support!


I am afraid my support lags... Sad I usually have just enough time and energy to scan "library" forums..

Anyway, these two bugs (this one and DnD) are bitch to resolve. Well, DnD is even worse as I see no signs of it on my machines. Maybe you could test some LOGs in CtrlCore?

Mirek
Re: A little proposal on code analysis [message #21259 is a reply to message #21258] Mon, 11 May 2009 01:43 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Mirek, I will help with anything I can - so testing LOGs is not a problem. I am only bound by amount of free time as I`m currently releasing big project for industrial automation.
BUT. I`ll try to do all debugging you ask within "rest" time breaks.
Re: A little proposal on code analysis [message #21263 is a reply to message #21259] Mon, 11 May 2009 10:19 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Another possibile reason of lag:

In ide/idewin.cpp, GUI_APP_MAIN comment out

ActivateUsrLog();

Mirek
Re: A little proposal on code analysis [message #21291 is a reply to message #21263] Tue, 12 May 2009 07:59 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Yesterday I compiled TheIde and I must say I also experience lags during typing. Maybe not so huge but still. My configuration is: AthlonX2 2Ghz 2GB Vista
Re: A little proposal on code analysis [message #21292 is a reply to message #21291] Tue, 12 May 2009 08:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
unodgs wrote on Tue, 12 May 2009 01:59

Yesterday I compiled TheIde and I must say I also experience lags during typing. Maybe not so huge but still. My configuration is: AthlonX2 2Ghz 2GB Vista


Even with all patches? Sad... Smile

Mirek
Re: A little proposal on code analysis [message #21293 is a reply to message #21263] Tue, 12 May 2009 08:28 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

luzr wrote on Mon, 11 May 2009 12:19

Another possibile reason of lag:

In ide/idewin.cpp, GUI_APP_MAIN comment out

ActivateUsrLog();

Mirek

Sorry, but bug is still there. But IMO it (lag) became smaller.
I also noticed that lag heavily depends on overall size and size of dependencies for ALL included and opened files, especially for the current one.
Turning off any applications and opening only one small .h file with only one CtrlLib.h/CtrlLib.h included, made bug almost disappear.
Re: A little proposal on code analysis [message #21294 is a reply to message #21293] Tue, 12 May 2009 08:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Tue, 12 May 2009 02:28

luzr wrote on Mon, 11 May 2009 12:19

Another possibile reason of lag:

In ide/idewin.cpp, GUI_APP_MAIN comment out

ActivateUsrLog();

Mirek

Sorry, but bug is still there. But IMO it (lag) became smaller.
I also noticed that lag heavily depends on overall size and size of dependencies for ALL included and opened files, especially for the current one.
Turning off any applications and opening only one small .h file with only one CtrlLib.h/CtrlLib.h included, made bug almost disappear.


OK.

First, one more possibility (but given what you wrote above, unlikely):

void Ide::Periodic()
{
//	CheckFileUpdate();
	SetIcon();
	if(debugger && debugger->IsFinished() && !IdeIsDebugLock())
		IdeEndDebug();
}


EDIT: Before bothering, try the patch below...

Second, we should decide if it is size of file or size of project or both.

Analyzing the code, I see no reason of influence of size of project (in fact, I believe that one was there and was fixed in the very first patch...).

Maybe you could try again plain CodeEditor and paste some very long file into it?

Thanks.

Mirek

[Updated on: Tue, 12 May 2009 09:08]

Report message to a moderator

Re: A little proposal on code analysis [message #21296 is a reply to message #21294] Tue, 12 May 2009 09:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
OK, what about this:

Quote:


void WorkspaceWork::TouchFile(const String& path)
{
if(!showtime)
return;
Time tm = GetSysTime();
String n = GetFileName(path);
for(int i = 0; i < filelist.GetCount(); i++) {
FileList::File f = filelist[i];
if(f.name == n && path == SourcePath(GetActivePackage(), f.name))
filelist.Set(i, f.name, f.icon, f.font, f.ink, false, 0,
Null, SColorMark, Null, Null, Null, SColorMark);
}
}



(problem fixed here would cause lag if you are in package with a lot of files...)

Mirek
Re: A little proposal on code analysis [message #21297 is a reply to message #21294] Tue, 12 May 2009 09:23 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Tried both patches (one w/o another) - and no success eliminating lag.

For now, I do always have a lag (it seems like OS restart is needed). But whan I succeeded in decreasing the lag, it was a strong dependency on amount of opened files and their size. One opened small file could possibly make lag smaller. It needs more thorough testing which I can make only in short periods (sorry, detached duty in 2 days - have to finish many things for now).
Re: A little proposal on code analysis [message #21298 is a reply to message #21297] Tue, 12 May 2009 09:53 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Tue, 12 May 2009 03:23

Tried both patches (one w/o another) - and no success eliminating lag.

For now, I do always have a lag (it seems like OS restart is needed). But whan I succeeded in decreasing the lag, it was a strong dependency on amount of opened files and their size. One opened small file could possibly make lag smaller. It needs more thorough testing which I can make only in short periods (sorry, detached duty in 2 days - have to finish many things for now).


OK, let me know if you have any new results...

Maybe Daniel can test meanwhile?

I have to say, I do not see any lag on my slow testing machine now...

Mirek
Re: A little proposal on code analysis [message #21299 is a reply to message #21298] Tue, 12 May 2009 10:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
OK, another attempt, this time more complex, so it is svn revision 1161. Fingers crossed...

I hope this is finally "it" Smile

Mirek
icon14.gif  Re: A little proposal on code analysis [message #21305 is a reply to message #21299] Tue, 12 May 2009 15:06 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

You did it. Lag is fixed. Thanks a lot!
Re: A little proposal on code analysis [message #21307 is a reply to message #21305] Tue, 12 May 2009 15:09 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
Mindtraveller wrote on Tue, 12 May 2009 09:06

You did it. Lag is fixed. Thanks a lot!


Uffffffffffffffffffffff.......... Smile

Mirek
Re: A little proposal on code analysis [message #21310 is a reply to message #21041] Tue, 12 May 2009 15:53 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 826
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
Any summary what went wrong? Smile
I'm curious and would love to learn more about it, although I don't want to check the code. Very Happy
Re: A little proposal on code analysis [message #21311 is a reply to message #21307] Tue, 12 May 2009 15:53 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Great job! TheIDE looks like even works faster (I mean, even quicker responsive to any actions). That is really cool!
Re: A little proposal on code analysis [message #21312 is a reply to message #21310] Tue, 12 May 2009 16:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14290
Registered: November 2005
Ultimate Member
mr_ped wrote on Tue, 12 May 2009 09:53

Any summary what went wrong? Smile
I'm curious and would love to learn more about it, although I don't want to check the code. Very Happy


Well, it turned out that problem was that many things were checking package files each for each Key event.

The bottleneck what the code to get the path of package - that involves scanning filesystem (PackagePath function). I have fixed the problem by adding a cache there.

Mirek
Re: A little proposal on code analysis [message #21314 is a reply to message #21307] Tue, 12 May 2009 19:23 Go to previous messageGo to next message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

luzr wrote on Tue, 12 May 2009 09:09

Mindtraveller wrote on Tue, 12 May 2009 09:06

You did it. Lag is fixed. Thanks a lot!


Uffffffffffffffffffffff.......... Smile

Mirek

The patch works perfect for me too! Thanks!
Re: A little proposal on code analysis [message #21320 is a reply to message #21314] Wed, 13 May 2009 04:34 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1428
Registered: September 2007
Ultimate Contributor
Yes, problem solved!

Thank You!
Re: A little proposal on code analysis [message #26800 is a reply to message #21320] Fri, 28 May 2010 15:52 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Mirek, I have bad news. The bug is again there.

PC: Pentium 4 CPU 2.8 GHz, 512 MB RAM
OS: WinXP SP2
PROJECT: 17 packages

The same project under home PC (Intel 2.5 GHz) is edited flawlessly, without TheIDE lags.

[Updated on: Fri, 28 May 2010 15:52]

Report message to a moderator

Previous Topic: Parser error sensitivity
Next Topic: Code assist default selection
Goto Forum:
  


Current Time: Sun Apr 26 01:03:12 GMT+2 2026

Total time taken to generate the page: 0.00987 seconds