Julian Foad writes:

 > These sorts of difficulties with (char *) strings, especially not
 > being able to pass them by value in any simple way, are the reasons
 > why the "string" class has come to exist.  THE "STRING" CLASS IS VERY
 > EFFICIENT!  (I'm speaking to everyone; I'm sure David already knows
 > this.)

That's what I had thought as well, but it turned out not to be the
case.  The string constructor is expensive, and we ended up using lots
(and lots and lots of them), running, as we were, 30-100 iterations
per second through hundreds of properties.  Switching from string to
char * gave a noticable framerate improvement -- even Norm was happy.

 > So, I beg for the getPath() member to return a "string" object.
 > This requires one simple patch to one existing caller (which needs to
 > have a temporary variable added to hold the result); the other callers
 > want a "string" anyway and so will be more than happy to receive one.

This isn't a bad idea, since getPath isn't used heavily in the loop.
I'll have to think about it a little more.

 > I would also argue for using the "string" class in make_string()
 > and other appropriate places.  This will remove the need for the
 > one-kilobyte temporary buffer that is presently included in EVERY
 > property node.

No, that's where the problem was.  There are ways that we can make
this more efficient, probably -- we could make the buffer lazy, for
example, or make it smaller.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to