On Mon, May 29, 2000 at 10:03:31PM -0700, Steven J. Owens wrote:
>
> Andy Croft asks:
> > > To clarify, I'll have a $thing I've whipped up created every time a group
> > > of players enter combat that acts as a "referee". At the end of combat, the
> > > referee object is destroyed. Now, after a year of 10 to twenty players
> > > duking it out will Cold be able to handle it? Bear in mind I'm still new to
> > > a powerful OOP environment like Cold. Please save the diesel fuel and
> > > matches, I'm painfully aware of my incompetence with Cold. <GRIN>
>
> Bruce writes:
> > Why not just create them as needed and when done with the match, return
> > them to a pool of un-managed referee objects? That way, if you only
> > ever have 10 matches at once, you only really need to create 10 refereee
> > objects, rather than an endless cycle of create+destroy.
>
> Just out of curiosity, what's wrong with an endless
> create/destroy cycle?
>
> I'm mostly a spectator on the cold list, but this general topic
> gets discussed a lot in Java circles, because object instantiation is
> so expensive in Java. The general tone, though, is that creating and
> destroying would be a more elegant design, if not for the limitations
> of the language environment.
Because objects are inherently persistent in ColdC, they also have a
unique identifier. This means you can theoretically run out of
identifiers since it is a signed 32bit number.
As far as overhead goes--that is more a core issue than anything. To
instantiate an object in ColdC (without hooking into the core) is
relatively lightweight--but then no initialization occurs either.
-Brandon Gillespie
PGP signature
|