Re: preventing c++ and stl code bloat?

  • From: "Littlefield, Tyler" <tyler@xxxxxxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Sat, 01 Jan 2011 16:03:26 -0700

OK, there's one major difference is the cross-platform stuff. My library runs on Linux, and I haven't really had many thoughts about changing it, so it just kind of stays on . I'll look at the others though. I haven't seen a need for regex quite yet, but maybe when I get to more advanced parsing I will. I've also been working on a POC for a parser I want to write, which will have it's own language and compile down to bitycode so that command parsing will be easier. So scripts as (lua for me) as well as anyone using c++ can use this language, and each registered command will just get a two-pass compilation; one to compile, and a second (and possibly third) for optomization so that the commands can be parsed out quicker. It'll end up looking something like: ($c <obj> [to] <living>) I also plan to do groups, so you can do something like: ($c <obj> [from] (#container in #container){3}|(#container)) which will let you nest get x from box in backpack or something, with a maximum of 3 matches. I think it looks messy now and I probably deviated a bit, but I'm just starting to kind of throw that around, so we'll see where it goes. I think it would speed up command parsing, which is going to be a huge thing in the mud with multiple players. I don't see bottlenecks yet, but I don't see why that can't be done to make things quicker, either. I've kind of looked at boost::spirit or something similar to write this out, as I think it would give me a lot more flexability; possibly bison, though I have never been able to understand how that works well enough to consider using it.

On 1/1/2011 1:40 PM, Ken Perry wrote:
Ok one thing is my server is cross platform all the file system stuff is
very useful.  So is the regular expression library.  I will also be using
the any library but I have not had time and will not till the summer.  If
you're doing cross platform with c++ though that is what boost is really
going to improve.  For example I also use the thread library.  One library I
would really like to switch to is wave but the problem is I currently use
bison and flex to create our compiler and switching that to wave grammar
would be a nightmare.  Before I did that I would just switch to a multi
scripting language library that would support things like python, lua, and
others.  I do like our functional language though so that is one reason I
have not done it.  I have been thinking of doing a side by side where I
support all those languages and my own but again I can't do that till after
this summer probably.\


-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
Tyler
Sent: Saturday, January 01, 2011 2:51 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: preventing c++ and stl code bloat?

I am curious where you find boost useful? I've tried numerous times to
look at it and play with it, but I haven't really seen anything I can
use out of it. Maybe it's just lack of experience with the library, but
things like serialization is done (though I want to use tinyxml), and
I'm not seeing where the rest of the library could be useful, so I'm
curious how you use it to help in mud development.
On 1/1/2011 12:18 AM, Ken Perry wrote:
I have started using boost and stl more which is why the code base has
shrunk but the binary has not grown that much you have to understand stl
is
mostly templates and compilers do a pretty good job now days if you are
already using a list for example you don't get a whole other code segment
of
list if you use two.  You pretty much should only get a data section if
the
compiler is working right.

Ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
Tyler
Sent: Saturday, January 01, 2011 1:51 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: preventing c++ and stl code bloat?

How much do you make use of the stl? I use it everywhere. From holding
options to holding lists of players, rooms, zones, sockets, etc. I could
use libraries (and may at some point, possibly for some other stuff),
but only if I really need to worry about code size. Right now I was just
getting kind of worried that the use of the stl is going to cause
headaches and problems at some point sooner or later.
On 12/31/2010 11:38 PM, Ken Perry wrote:
I have 67,000 lines and I am at 11 mb debug and 900kb stripped.

I was not much bigger when I was at 100,000 lines of code.  I have shrunk
it
by using libraries but the binary comes out about the same.

ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Littlefield,
Tyler
Sent: Saturday, January 01, 2011 1:16 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: preventing c++ and stl code bloat?

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

Other related posts: