Boost logo

Boost :

From: Noah Stein (noah_at_[hidden])
Date: 2001-10-23 13:17:27

In regards to MSVC's handling of template code, here's some of what I've
found in my experience:

* Debug and release versions are rather asymmetric in their performance.
MSVC will not inline code in debug builds (well, it might with some tweaking
of the project options). For something recursive like Blitz's comma-list
assignment, this can be quite a painful difference.

* As others have pointed out, if a variable isn't used in a release build,
it will almost definitely be optimized out completely. For the template
code I've written, MSVC optimizes well.

* Don't trust the "inline" keyword in MSVC, it doesn't work as much as you'd
think. I wrote a vector-matrix library a year ago. I liked the Blitz
comma-list assignment, so I added one. I looked at the release code for the
matrix class, and it was what I expected: a list of immediate data stored in
the variable. The vector, however, did not inline its code. Using
"__forceinline" solved that problem. I would suggest setting
inline=__forceinline in your project's compilation setting.

* MSVC really needs to support partial specialization. Yeah, everyone knows
it. Everyone says it. But I have to live with this headache every day, so
I had to say it once, too.

-- Noah

Boost list run by bdawes at, gregod at, cpdaniel at, john at