strange compiler optimizations

"Quinn Tyler Jackson" <qjackson@wave.home.com>
10 Aug 1998 10:05:52 -0400

          From comp.compilers

Related articles
strange compiler optimizations qjackson@wave.home.com (Quinn Tyler Jackson) (1998-08-10)
Re: strange compiler optimizations mtimmerm@microstar.no-spam.com (Matt Timmermans) (1998-08-13)
Re: strange compiler optimizations clark@quarry.zk3.dec.com (Chris Clark USG) (1998-08-19)
| List of all articles for this month |
From: "Quinn Tyler Jackson" <qjackson@wave.home.com>
Newsgroups: comp.compilers
Date: 10 Aug 1998 10:05:52 -0400
Organization: Compilers Central
Keywords: optimize, practice

I just compiled two version of some speed tests for LPM under Visual C++
5.0, and was shocked to get these results.


When I turned on OPTIMIZE FOR SPEED -- I got the following results:


        PLPM: 67
        LPM: 27


{That's how many milliseconds it took to find the target text at the end of
100kb of junk that included 10 purposely introduced near but false hits.
The pattern being looked for was fairly complex:


                ['\\<'$
                        [*' '$
                        [^
                                [+'a-zA-Z'#
                        ['{TAG}'^
                        [+' '$
                        ['{ATTRIB}'{NOCASE}$
                        [*' '$
                        ['='$
                        [*' '$
                        [+'a-zA-Z'#
                        [*' '$
                ['\\>'$
                [^
                        [*?
                ['html_{TAG}'^
                ['\\<'$
                        ['/'$
                        ['{TAG}'!
                ['\\>'$


which finds any balanced tag pair of the form


        <a tag=value> some stuff </a>


}


Then I turned on OPTIMIZE FOR SIZE -- I got the following results:


        PLPM: 21
        LPM: 36


Why on earth did OPTIMIZE FOR SPEED do so poorly with PLPM and OPTIMIZE FOR
SIZE do so well, where it behaved as expected for LPM?


--
Quinn Tyler Jackson


email: qjackson@wave.home.com
url: http://www.qtj.net/~quinn/
ftp: qtj.net
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.