Kevin Scaldeferri on 5 Jun 2003 21:35:02 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[ALACPP] Notes -- Chapter 4


Here's my summary of yesterday's discussion & other notes from my
reading.  

Chapter 4 of Alexandrescu -- Small Object Allocator

Okay, this chapter didn't make me cringe. Here's a example of where
using C is nice, because you can override fairly fundamental parts of
the system (i.e. how things are laid out in memory.) This is a lot
harder, if not impossible, in most other languages.

I got tripped up for a bit on a little issue of language semantics. The
statement:

Lock lock; 

does totally different things in C++ and Java. I'm used to Java, at this
point, where this just creates a null pointer that you need to assign to
later. However, in C++ this actually constructs a Lock object on the
stack. Consequently, what looked to me like a bit of dead code can
actually do something significant though the implicit invocation of the
constructor and destructor (when you exit the block).

A lot of the discussion yesterday revolved around the fact that it seems
that this chapter may be largely obsolete. Apparently in the 2 years
since publication, compiler writers have learned some of these tricks,
so some compilers are as good or better at small object allocation than
Loki. Either that, or said compilers are not good at optimizing the Loki
allocator.

There was also a bit of talk about the article on templates vs. ML that
I posted last week: http://www.kuro5hin.org/story/2003/5/26/22429/7674
but we couldn't seem to remember the details well enough to really
discuss the interesting questions.

_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp