Author Topic: I need some benchmarks for the codecompletion, any volunteers?  (Read 9829 times)

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
For those wanting to help my mad scientist experiments, I need some benchmarks.

Here's what I need:

1) Open Code::Blocks and load the codeblocks.prj cbp (or codeblocks_unix.prj cbp, whatever)
2) wait until all the symbols appear on the symbols tree.
3) Choose the "Symbols" tab, and click on the "-" next to the  "Symbols" item of the tree, and wait for it to close
4) Prepare your stopwatches.
5) Click on the "+" and count the time until the class browser stops growing.

Also please share the speed of your machine (CPU) and operating system.

Thanks!
« Last Edit: July 07, 2007, 08:16:16 am by rickg22 »

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: I need some benchmarks for the codecompletion, any volunteers?
« Reply #1 on: July 07, 2007, 02:02:31 am »
First, the extension of the project files is cbp, not prj :P

I just followed your steps and it's instantaneous. Did you miss something in yours steps?

Intel Core 2 DUO 2.4GHz on Gentoo AMD64.

And just in case: svn 4235 with wxGTK 2.8.4.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: I need some benchmarks for the codecompletion, any volunteers?
« Reply #2 on: July 07, 2007, 08:15:45 am »
hmmm ok thanks :) Is it really really instantaneous? Wow... here in windows it's kinda slow... any windows benchmarks, anyone?

Offline jpaterso

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: I need some benchmarks for the codecompletion, any volunteers?
« Reply #3 on: July 07, 2007, 10:56:02 am »
Hey,

WinXP with a PM1.7 Ghz, 1024 ram... SVN 4235 and it takes just about 2 seconds.

Hope that helps!

Joseph.

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: I need some benchmarks for the codecompletion, any volunteers?
« Reply #4 on: July 07, 2007, 01:09:29 pm »
I just tried the same thing on the same machine, but this time on Windows XP (running through VMWare Server though) and it takes about 0.5 seconds.

And with instantaneous I meant that I couldn't even see the 'growing' effect.

Now I would like to see more Linux benchmarks :wink:

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: I need some benchmarks for the codecompletion, any volunteers?
« Reply #5 on: July 07, 2007, 01:32:46 pm »
About 2.8 seconds.

Pentium 4 3.0GHz HT. Windows XP.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Thanks!
« Reply #6 on: July 08, 2007, 10:45:53 am »
Ceniza: Maybe in Linux you don't see that effect, but I see it on windows all the time (the scrollbar 'growing'). Must be implementations difference.

Thanks for the info guys, I just wanted to confirm something. The class browser is built in the main thread on windows. This explains the sudden pause during the tree construction (you can't move the window, press any key, etc).

Anyway, I did some benchmarks of my own, and I think I found the cause for the slow construction of the tree. This is what I got with the codeblocks_rick.cbp and the help plugin, and for both:

Quote
[03:25:45.796]: Updating class browser...
[03:25:48.750]: Class browser updated (682 nodes added in 234955 search operations).
[03:30:38.484]: Class browser updated (5 nodes added in 36 search operations).
[03:31:45.625]: Class browser updated (682 nodes added in 238395 search operations).

and it's no coincidence that 234955 =~ 682^2 / 2. It's the 1 + 2 + ... N formula discovered by Gauss. In other words, it means that the tree construction takes quadratic complexity.

Where? The tree construction is based on a routine called "AddNodeIfNotThere". It searches ALL the nodes to see if there's anyone matching the current token name. And this happens for all nodes added. So at first it searches for one node, then two, three, etc. So the number of operations done to add the whole tree are: 1 + 2 + 3 + ... N.

I made an experiment. I removed the search and added all the nodes to the tree (even if there were duplicates). The tree was constructed around at least 4 times faster!! (It shouldn't surprise us, without checks the tree is constructed in linear time).

Currently I'm optimizing the algorithm to do a binary search instead a linear search, this will cut the searches from O(N^2) to O(N log(N)).
« Last Edit: July 08, 2007, 10:54:14 am by rickg22 »

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: I need some benchmarks for the codecompletion, any volunteers?
« Reply #7 on: July 08, 2007, 08:02:39 pm »
It seems to be more of a Windows problem then. I just tried the same thing on that P4 using Kubuntu Feisty and it's about as instantaneous as it's here. It takes perhaps ~0.2 seconds in that P4, and no "growing" effect either.

Offline pauliusz

  • Multiple posting newcomer
  • *
  • Posts: 73
Re: I need some benchmarks for the codecompletion, any volunteers?
« Reply #8 on: July 09, 2007, 12:47:42 am »
~1 second on Windows 2000 SP4, Athlon XP 2500+, 512MB RAM, CB rev 4238, wx284.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: I need some benchmarks for the codecompletion, any volunteers?
« Reply #9 on: July 09, 2007, 02:59:55 am »
OK I tested with build 4238... the addition of nodes seems very fast. HOWEVER...

I did the following experiment. I closed the root node, and opened it again. IMMEDIATELY i switched to the files, and tried to press the DOWN key. I couldn't do anything for... 1.47 seconds.

OK, guys, I got all the data I needed. Thank you for your cooperation :)