MySQL Forums
Forum List  »  Falcon

Bitmap questions
Posted by: Vincent Van Den Berghe
Date: August 13, 2007 12:19AM

It's oh so quiet, it's oh so still...

At the risk of hearing nothing but my own echo, here are two things about the Bitmap class (Bitmap.cpp). If the eminent developers feel like anwering, call these things "questions". Otherwise, call them "thoughts":

(1) In Bitmap::nextSet(int32 start) we see

if(!vector)
{
...
if(level==0)
return -1;
}

I am wondering if there can ever be a case where vector==NULL and level!=0. If not, that if-statement is superfluous.

(2) In Bitmap::setSafe(int32 bitNumber)
I'm not sure what's going on here: it seems to be a thread-safe version of Bitmap::set, with the added condition that the path to bitNumber should already exist. Anyway, a lot of effort seems to be in making all changes to the set structure thread-safe without using locks.
However, I think the method is using locks big time: every call to "new" (through allocVector) or "delete" manipulates the global heap, which is usually protected by a single lock. Although many modern C++ heap allocators have a preallocated "small object heap" (some of them on a per-thread basis to avoid locking), there's no guarantee that new/delete will use it. This has to be benchmarked of course, but I wonder if a straightforward rw-lock use would use less cycles and be more concurrent than the code in setSafe...
Unless of course I completely misunderstand the code in setSafe.


Vincent

Options: ReplyQuote


Subject
Written By
Posted
Bitmap questions
August 13, 2007 12:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.