Re: preventing c++ and stl code bloat?

  • From: "Littlefield, Tyler" <tyler@xxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Sat, 01 Jan 2011 00:39:43 -0700

Hello,

I am not overly worried about the code size, I was just noticing that the STL seems to have increased the size a lot more than I really wanted. What I was doing is including all headers in mud.h, then just including mud.h, too. I am moving everything to only include the headers it requires, so we'll see if that fixes things. I never really thought about it, as I seen another project do that and it looked nice. I'm noticing compile times shoot through the roof though, so if I can keep my eyes open long enough to convert the rest of this, we'll see how it goes.
On 1/1/2011 12:19 AM, Dave wrote:
Hey Ty,

Why are you worried about increasing compiled binary size?  Templated
types are only generated if you use them (i.e. a vector of players,
rooms, etc).  If you hand-roll a version of vector's to handle each
datatype (i.e. a vector_player, vector_room type) you get the same
exact compiled binary size plus untested code.  I think this is the
argument you saw elsewhere?

If you're worried about debugging load times (which I've seen as a
problem moreso), you can look at splitting your project into multiple
dll's, so you only load dll's as you use them at runtime (i.e. with
LoadLibrary()).
On 12/31/10, Littlefield, Tyler<tyler@xxxxxxxxxxxxx>  wrote:
Hello all,
I've been doing some googling, and I have a quick question. With my mud
engine nearing 10k lines of code, I'm starting to get worried about the
fact that with debugging I'm looking at a 3.5m executable. without
debugging symbols, we're at about 600 kb. Now, while this isn't a whole
lot, where will I be in twice the amount of code? three times? 5 times?
I believe a huge problem is the STL, I'm just not really sure how to cut
down on the massive amount of code that was apparently generated as part
of my lists and vectors that I use. Ideas here would be welcome. I was
told (or read somewhere) that game engines just write their own types,
which makes sense, but I see multiple problems with this. 1) you're
basically defeating the purpose of templates just to rewrite code, and
each new type you rewrite to handle a list of sockets, a list of
players, etc etc may or may not be more or less bloated and have bugs.

As always, you can grab the code from:
svn://tds-solutions.net/branches/unstable/aspen if you care to peek at
it. It's still in early development phases, though it's coming along
quite nicely every day I add to it, so be ware lack of documentation in
some places, bad code, bugs, etc etc.

--

Thanks,
Ty

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind
Hello,




--

Thanks,
Ty

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: