It is currently Sat May 25, 2013 8:57 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Debug output is terribly slow
PostPosted: Tue Jan 24, 2012 5:42 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Dec 03, 2011 5:54 pm
Posts: 253
Hi,

if you try the following code, it takes almost a minute to complete:
Code:
For i = 1 To 10000
  Debug i
Next

The same code in python on the same machine takes less a second:
Code:
for i in range(10000):
  print i

Just to let you know, that there is potential :-)

Best regards
Uwe

_________________
Purebasic 5.11 | Fedora 18 (32-bit)


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Tue Jan 24, 2012 6:58 pm 
Online
Addict
Addict
User avatar

Joined: Mon Jul 25, 2005 3:51 pm
Posts: 2401
Location: Utah, USA
uwekel wrote:
if you try the following code, it takes almost a minute to complete:
Code:
For i = 1 To 10000
  Debug i
Next

The same code in python on the same machine takes less a second:
Code:
for i in range(10000):
  print i

Just to let you know, that there is potential :-)


Is that code in python for debugging? For comparison use similar (non-debug) code in PureBasic and it will also run in less than a second:
Code:
OpenConsole()
For i = 1 To 10000
  PrintN(Str(i))
Next
Input()

_________________
Image


Last edited by Demivec on Tue Jan 24, 2012 9:13 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Tue Jan 24, 2012 8:10 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Dec 03, 2011 5:54 pm
Posts: 253
Yes, in Python the debugger is enabled (i just pressed F5 in Wing IDE).

What you can notice is that PB gets slower with every line of debug output. Maybe the output line will not actually appends to the list, but replaces the whole output text, e.g. something like
Code:
Debug$ = Debug$ + #LF$ + Line$
... but that's just a guess.

_________________
Purebasic 5.11 | Fedora 18 (32-bit)


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Tue Jan 24, 2012 8:30 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5188
Location: Germany
The debug output is a convenience method for debugging. Its not intended for high-speed output. The console library is better suited for that.

_________________
Perl – The only language that looks the same before and after RSA encryption.
-- Keith Bostic


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Tue Jan 24, 2012 8:33 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 4715
Location: Berlin - Germany
I think your problem have to do with this: viewtopic.php?p=370646#p370646

Greetings - Thomas

_________________
PureBasic 5.11 | Windows 7 SP1 (x64) | Mageia 3 (x64) | RealSource

The use of EnableExplicit is free of charge and avoids errors.


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Wed Jan 25, 2012 1:01 pm 
Offline
Always Here
Always Here
User avatar

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7304
Location: Norway
It takes less than 15 seconds here. But GTK is a horribly slow toolkit so I guess the Linux version would use much longer time.

_________________
Woa, I set up a web server.


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Wed Jan 25, 2012 1:17 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Dec 20, 2003 6:19 pm
Posts: 467
Location: Switzerland
Trond wrote:
It takes less than 15 seconds here. But GTK is a horribly slow toolkit so I guess the Linux version would use much longer time.

3 seconds here :wink:

@uwekel: Besides debug not being the fastest, in what
circumstances do you want your debug-window filled so fast
that you are unable to read it? :P
Logging to a file seems to be the better solution in those cases.

Btw, it does not slow down here with every line of debug output.

_________________
Athlon64 3700+, 1024MB Ram, Radeon X1600


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Wed Jan 25, 2012 8:58 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Dec 03, 2011 5:54 pm
Posts: 253
I often use the Debug command to print some values to the output window. In my special case i received a bunch of lines from a newsserver. There was no need to read every line because it contained encoded data, but i just wanted to see the receiving result of an NNTP command.

I know the slowness is not dramatic and i just wanted to drop a note.

Quote:
But GTK is a horribly slow toolkit so I guess the Linux version would use much longer time.

I don't think that we can blame it on GTK. The Wing IDE use GTK as well :-)

Quote:
Btw, it does not slow down here with every line of debug output.

Maybe it is a Linux problem.

Best regards
Uwe

_________________
Purebasic 5.11 | Fedora 18 (32-bit)


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Wed Jan 25, 2012 9:32 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Dec 20, 2003 6:19 pm
Posts: 467
Location: Switzerland
uwekel wrote:
[..]
Quote:
But GTK is a horribly slow toolkit so I guess the Linux version would use much longer time.

I don't think that we can blame it on GTK. The Wing IDE use GTK as well :-)

Quote:
Btw, it does not slow down here with every line of debug output.

Maybe it is a Linux problem.

Oh, I didn't mention that I was also using GTK on Linux.
But you were right, changing from 10'000 to 100'000
shows the slowdown here too.

Quote:
I often use the Debug command to print some values to the output window. In my special case i received a bunch of lines from a newsserver. There was no need to read every line because it contained encoded data, but i just wanted to see the receiving result of an NNTP command.

Well I understand. Sometimes I also just want to see
what is currently going on. In that case it would
be useful if the debug-window had a buffer limit and
would just show the last 100 lines or so. Then again
I was often cursing Eclipse because it didn't keep enough
lines in the output window :P And as others were
suggesting, with an open terminal window you actually
get exactly this behaviour.

_________________
Athlon64 3700+, 1024MB Ram, Radeon X1600


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Thu Jan 26, 2012 10:02 am 
Offline
Always Here
Always Here
User avatar

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7304
Location: Norway
uwekel wrote:
Quote:
But GTK is a horribly slow toolkit so I guess the Linux version would use much longer time.

I don't think that we can blame it on GTK. The Wing IDE use GTK as well :-)
The python console in Wing is actually a scintilla widget. You can tell by the prolonged horizontal scrollbar and the context menu that appears a few pixels off (and also Wing IDE is listed as using scintilla on scintilla.org).

_________________
Woa, I set up a web server.


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Thu Jan 26, 2012 10:03 am 
Offline
Always Here
Always Here
User avatar

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7304
Location: Norway
I don't know if freak is still reading, but the performance could very likely be improved manifold simply by setting the all-rows-equal-height or similar sounding gtk property on the list.

_________________
Woa, I set up a web server.


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Thu Jan 26, 2012 9:47 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Dec 03, 2011 5:54 pm
Posts: 253
Quote:
But you were right, changing from 10'000 to 100'000 shows the slowdown here too.

That surprises me. I have an Intel i7-2600K with 8GB ram but no graphic card (i use the onboard intel graphics). Why the hell it is so slow?

_________________
Purebasic 5.11 | Fedora 18 (32-bit)


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Thu Jan 26, 2012 10:21 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Dec 20, 2003 6:19 pm
Posts: 467
Location: Switzerland
Interesting, I'm on Ubuntu 11.10 x64 with an Intel M620@2.67
with 8GB RAM and using the Intel onboard graphics card :)
Running PB on the Optimus powered Nvidia GT218 [NVS 3100M]
does not change anything.

Well, maybe you should try compiz as the window compositor
like used in Unity or XFCE. GnomeShell for example has still
some performance problems with some workloads.

_________________
Athlon64 3700+, 1024MB Ram, Radeon X1600


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Thu Jan 26, 2012 11:05 pm 
Offline
Addict
Addict

Joined: Tue Feb 22, 2011 1:16 pm
Posts: 1461
uwekel wrote:
Why the hell it is so slow?

Because it's a debug output, not a runtime output (as Freak said). It's just meant to be used to display something to you to aid in debugging. Using it in a tight for/next loop like that is not debugging. You're trying to force it to be a pseudo-window instead of its intended purpose. "Debug" in PureBasic is not the same thing as "Print" in Python.

_________________
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!


Top
 Profile  
 
 Post subject: Re: Debug output is terribly slow
PostPosted: Mon Jan 30, 2012 11:44 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Aug 27, 2011 9:50 pm
Posts: 107
Location: Washington, USA
Is Purebasic by any chance doing something like copying the entire current debug window data to a new structure every time text is added? Because my experience with the debug window (on Windows) does seem to result in it getting significantly slower to add data to it the more elements are in it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye