Re: PRF & PLR flags max 32?

From: Elie Rosenblum (fnord@cosanostra.net)
Date: 01/25/02


On Thu, Jan 24, 2002 at 06:45:03PM -0800, Daniel A. Koepke wrote:
> To be honest, the standard STL implementation of std::bitset<N> is
> considerably better optimized than your bitvect class.  You're doing a lot
> of unnecessary copying[1] and have a ton of space overhead.  This is not
> even accounting for the one-word bit set specialization.  In addition,
> system headers can often take advantage of knowing how the compiler
> optimizes things or what architecture you're on, and provide more
> efficient implementations than you would want to by hand (e.g., it might
> implement some copies in assembly).
>
> A good, easy start to optimizing your code would be to go through and use
> const references as arguments in functions where a local copy is not
> necessary.  E.g., instead of your,
>
>   inline bitvect operator |(bitvect a, bitvect b)
>   { . . . }
>
> we do,
>
>   inline bitvect operator |(const bitvect& a, const bitvect& b)
>   { . . . }
>
> which saves two copies (meaning, two calls to the copy constructor, which
> is probably a loop over an assignment to bitvect::vector[] elements).

Amusingly, I already went through the code and did this last week. I
also marked __attribute((__const__)) on all the functions where it's
true, and fixed my sysdep stuff to make __attribute(foo) disappear if
you're not compiling under GCC.

> Your other goals, however, are not so easily deflected, and bitvect still
> wins out if you're truly wishing to remain as close as possible to stock
> CircleMUD.

Indeed.

--
Elie Rosenblum                 That is not dead which can eternal lie,
http://www.cosanostra.net   And with strange aeons even death may die.
Admin / Mercenary / System Programmer             - _The Necronomicon_

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT