Paul McCullagh wrote: > And we should watch out for things like this: > > The MySQL version: > > bitmap_is_subset(x, y) > > The C++ "way": > > (x & y) == x > > It looks cute, but how is it implemented!?
Not very well, unfortunately. But that doesn't mean it can be implemented in a good and efficient way. > The thing is, there are simply great ways to optimize this operation if > you write custom code to do it. > > Another problem I see is that the bitmap implementation basically > encourages sub-optimal code. Take a look at the Drizzle implementation > of ha_get_max_bit() (a function I use in PBXT) below. The Drizzle > version is maybe 100 times more understandable, but I would guess the > MySQL version is at least 10 times faster! > > In general the thing that makes me suspicious of the C++ standard lib is > that it is not necessarily written to be "database server grade" > (especially if they put the emphasis on readability instead of speed). > > By "database server grade" I mean _every_ instruction counts. There is nothing in the standard library that makes it unsuitable for applications where every instruction counts (I've hacked embedded systems in C++, very small ones, and there code size is really critical). However, as with any versatile tool, it is easy to misuse it if you do not understand when and how the constructions are intended to be used. Just my few cents, Mats Kindahl -- Mats Kindahl Senior Software Engineer Database Technology Group Sun Microsystems _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

