Board index » cppbuilder » BCB 6 Compiler slowness and how to speed it up dramatically

BCB 6 Compiler slowness and how to speed it up dramatically


2005-12-07 10:36:47 AM
cppbuilder89
While I'm improving bcc32pch I found the reason why code insight and the
IDE compiler are that slow.
First the speed differences on a (3GHz HT):
Project: 1 datamodule and 2 forms with some buttons and 3 lines of added
code: Close(), Show(), Close()
original IDE Compiler: 31.34 secs
After patching: 4.36 secs
What has happend:
The coreide.bpl registeres some callback functions to the IDE Compiler.
One of these is an OpenFile callback function that is called for every
file opening by the compiler. But not only for existing files. The
compiler uses OpenFile to test if a file exists or not. During compilation
this happens very, very, very, very, ... often. And what does the
coreide.bpl implementation of OpenFile do? It takes a lot of time for non
existent files, increasing the compiletime dramatically.
The patch is simple: Call GetFileAttributes before invoking the original
OpenFile implementation and return immediatelly if the file does not
exist. This modification has also a positive impact on the code insight.
The kibiz compiler also uses the OpenFile callback. Dam, is it fast now.
I haven't looked at Delphi's callback function yet, but I could bet there
is the same problem even if the compiler is a lot faster *I hope this is
so, because then Delphi would get a speed boost in compilation and code
insight*
And here a statistic:
OpenFile callback:
VALUE HANDLES:
execution time: 257.4814 ms
execution count: 794 (send to original OpenFile callback)
average exec. time: 0.324284 ms
INVALID_HANDLE_VALUE:
execution count: 7988 (catched by GetFileAttributes)
Until I have completed the next version of my bcc32pch tool, you can
download a very small package that fixes this bug.
The "IDE Compiler Speed Improvement" package can be downloaded from here:
unvclx.sf.net/downloads/IDECompilerSpeedFix.zip
The zip files contains a precompiled package for BCB 6 and BCB 5
(untested) and the source code.
--
Regards,
Andreas Hausladen
 
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

In article <43964a50$ XXXX@XXXXX.COM >,
"Andreas Hausladen" < XXXX@XXXXX.COM >wrote:
Quote
original IDE Compiler: 31.34 secs
After patching: 4.36 secs

What has happend:
The coreide.bpl registeres some callback functions to the IDE Compiler.
One of these is an OpenFile callback function that is called for every
file opening by the compiler. But not only for existing files. The
compiler uses OpenFile to test if a file exists or not. During compilation
this happens very, very, very, very, ... often. And what does the
coreide.bpl implementation of OpenFile do? It takes a lot of time for non
existent files, increasing the compiletime dramatically.
Would you mind fashioning this into a QC report? If it hasn't been
fixed in BDS2006, that will help to get it fixed in the next version.
--
-David
Nihil curo de ista tua stulta superstitione.
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Andreas Hausladen wrote:
Quote
Until I have completed the next version of my bcc32pch tool, you can
download a very small package that fixes this bug.
I downloaded it, created a new package, and built it, as I have BCB4, and
WOW!!!, the code insight is almost instant.
This is a really wonderful improvement.
Jonathan
 

{smallsort}

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Andreas Hausladen wrote:
Quote
While I'm improving bcc32pch I found the reason why code insight and the
IDE compiler are that slow.
Andreas,
a big thank you :)
I've tried this with BCB 2006 and I think it made quite a bit of
difference. More final results tomorrow, when I can sit in front of my
PC, instead of being connected to it remotely (GoToMyPC service).
I had to modify the source to use different name for the coreide and
create an import library for bccide.dll.
Regards,
Alex
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Wow... your patch made BCB 6's "broken" Code Insight competely usable now!
Thank you!!!
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

I give Andreas a standing ovation for this patch !
After installing the patch within bcb6 the difference is just amazing.
I've a AMD64 3400 with 512 MB RAM
I have not done any optimization within the project I've compiled and
here are the facts :
WITH patch
avarage time 19 secs
WITHOUT patch
avarage time 81 secs
I've run the compilation about 5 times.
Shame on you Borland for not fixing this
Again : GREAT JOB Andreas
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Hi Andreas,
you did a great job with that.
But how did you find out that this callback was the bottleneck? Running
the IDE in a profiler? I doubt that you have a debug version of BCB?
I'm just curious how to find out these things. Especially if you have no
source code for it.
It's unbelivable that Borland wasn't able to fix that. They had more
than five years for it and I think this bug is not too hard to find if
you have the source code.
It's a pity that all the code speed up tools came up at the end of
BCB5/6 lifetime.
Our software group will switch now to MS and I think more and more that
this was the right decision. A compiler manufacturer who doesn't care
about its customers is a very high risk for software developing and I
doubt that this will change in the future.
So, enough complaining, we had too much threads in this direction ;-)
Bye, Oliver
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Oliver Rutsch wrote:
Quote
But how did you find out that this callback was the bottleneck?
With lots of try and error with access vioalations.
Quote
Running the IDE in a profiler?
No. I found this bottleneck after finishing the "command line IDE
compiler". And the reason why I wanted to use the IDE Compiler at command
line is that bcc32.exe is a different compiler and throughs an assertion
if you execute such code: "obj->prop = ++intValue;". The IDE Compiler does
not have this bug. And also the "force includes" and "advanced PCH
support" was easier to implement because of the callbacks.
Quote
I doubt that you have a debug version of BCB?
I'm just curious how to find out these things. Especially if you have no
source code for it.
Again: Try and error with lots of access violations.
Quote
It's unbelivable that Borland wasn't able to fix
that. They had more than five years for it and I think this bug is not
too hard to find if you have the source code.
It is hard to find because it is in a callback. The first impression you
get is that the compiler is very slow. And what should you do as an "core
IDE developer"? You think: "It's the compiler guys who should fix this."
Quote
It's a pity that all the
code speed up tools came up at the end of BCB5/6 lifetime.
My interest in C++ is back for some months now. Before I hadn't touched
C++ for years (Borland C++ 4.5).
--
Regards,
Andreas Hausladen
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

"Andreas Hausladen" < XXXX@XXXXX.COM >wrote in message
<snip>
: The zip files contains a precompiled package for BCB 6 and BCB 5
: (untested) and the source code.
Hi Andreas,
Sorry to bother you with this; I'm sure you don't want to open up a support
line for the patch...
I'm keen to try this out on our BCB5 installations; after installing your
precompiled package for BCB5 (using Component|Install Packages in the IDE;
no projects open) I get an AV in bccide.dll each time I shut BCB5 down (with
or without a project open), trying to read 00000000.
Would I be best off trying to create a new package for it?
Thanks for any advice,
GT
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Graham Thompson wrote:
Quote
Would I be best off trying to create a new package for it?
I do not have BCB 5, so I can only guess on that. The precompiled package
is compiled with Delphi 5 (which does not have a C++ compiler).
--
Regards,
Andreas Hausladen
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Andreas Hausladen wrote:
Quote
Graham Thompson wrote:

>Would I be best off trying to create a new package for it?

I do not have BCB 5, so I can only guess on that. The precompiled package
is compiled with Delphi 5 (which does not have a C++ compiler).
Ah, that is because the
@Cominout@CPPCompilerInit$qqrpqqsr22Cominout@TCppCallbacks$v is not found
in coreide50.bpl. So the OrgComInOut pointer is never initialized. And
when unloading the package I restore the original Compiler's callback what
in your case tries to dereference a null pointer.
I assumed that the package is called coreide50.bpl. But Delphi 5 says
coride50.bpl (without the "e"). I'll update the download with this.
--
Regards,
Andreas Hausladen
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Jonathan Benedicto wrote:
Quote
This is a really wonderful improvement.
Was the coreide40.bpl name correct or have you changed it to something
like "coride40.bpl" (without the "e") ?
--
Regards,
Andreas Hausladen
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Andreas Hausladen wrote:
Quote
I assumed that the package is called coreide50.bpl. But Delphi 5 says
coride50.bpl (without the "e"). I'll update the download with this.
Updated.
--
Regards,
Andreas Hausladen
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Quote
I assumed that the package is called coreide50.bpl. But Delphi 5 says
coride50.bpl (without the "e"). I'll update the download with this.
I'm running BCBv5, can you let us know when you've updated it please.
Thank you.
 

Re:BCB 6 Compiler slowness and how to speed it up dramatically

Alex Bakaev [TeamB] wrote:
Quote
I had to modify the source to use different name for the coreide and
create an import library for bccide.dll.
What is the name of coreide.bpl ? Is it coreide100.bpl ?
--
Regards,
Andreas Hausladen