in reply to Re: define analyser - performance problem
in thread define analyser - performance problem

I like the idea of using the compiler itself! I use this -E option when working with macros and gcc. I think this is a standard feature of most C compilers (the option may of course be called something else on yours).

Another thought...sounds like you are into a maintenance problem. Not sure what kind of application could generate that many macros!!! But anyway you might consider converting a bunch of these things into "inline" subroutines. That yields performance of a macro but with type checking etc on the args. Lots of compilers (including gcc) support this. I presume you are driven into writing this code because its hard to figure what these macros are really doing! Maybe a bigger project that "fixes" the source code is in order? I have worked on projects before where Perl actually writes code and .h files as part of pre-compile step - this is a weird idea, but in right app, it can work. 13,000 macros is a mind boggling number - even on a big ASM project!

I have found that using some of the special variables like $+ can slow things down a lot with regex - some of these things can introduce extra overhead - sorry can't find a code example of last case where I found this.

The most likely suspect is the regex related code. I would use a subset of test data to try to find out: a)if exe time scales linearly or exponentially, b)maybe by hacking around, you can find some types of macros that take WAY longer than others. Sorry that I can't be of more help right now.

  • Comment on Re^2: define analyser - performance problem

Replies are listed 'Best First'.
Re^3: define analyser - performance problem
by grizzley (Chaplain) on Jun 30, 2009 at 06:55 UTC
    Yeah, the code is a nightmare. It was Win32 COM application, and at some point people decided to port it to linux. Instead of rewriting code, they have written some classes and macros to imitate COM behaviour (hiding unix functions inside). It is now really a mess and company I am working in, takes it over subsystem after subsystem and tries to clean it up...
      I wish you well! Sorry to sound flippant, but this does sound like a mess! The good news is that Perl can probably help! But the job is gonna be "nasty".

      Somewhere along my foreign language training, I heard that VOA (Voice of America) transmits with a total vocabulary of about 8,000 words. That is actually an astonishingly small number for English (you probably have a passive vocabulary of way more than 20K words). I would say that 13,000 is an astonishingly large number of macros! This is so many that we are talking about a foreign language!

        Well, 13.000 is nothing compared to number of acronyms used in documentation... :)