Hi,
 this is a patch to speed up startup times and some other misc things.
Please kindly try it out on your configurations.  Commenting on each
file/change:

nasal/misc.h:
    If p == 0 return, else call free(p). Dont go into the malloc lib for
nothing, probably free() does this check 1st thing in most implementations,
no need to test the malloc library. p == 0 happens, checked with debugger.

logstream.cxx:
    Modified a bit the logstream implementation to avoid (stack) descent
down into (iostream) hell if we are not logging anything anyway. As it is
right now, it happily builds the string to print (iostream hell, deep
stacks, strings new/delete/copy) and then discards it. I´ve counted over
half a million calls to sglog() before the scenery is fully loaded (cant
remember with what configuration, more on config below).
    Also, the global logstream is initialized once at startup (constructors,
struct ignore_me), no need to check everytime it is called if it's
initialized. Maybe if sglog() is used in any global constructor it could
happen that it is not initialized and crash, so please, dont use it in the
global constructors ;)

strutils.cxx, simple..cxx, apt_loader.cxx
    Accelerate parsing of apt.dat. As it stands it does aprox 5 (five)
million wasteful new/delete pairs, mostly in the strutils::split,
vector<runway> growing and unnecessary string initializations in the main
parse loop. Now it does >1 million new (1 per airport, 2 per runway/taxiway)
and <100 (hundred) deletes. I find it's acceptably fast now. Also, it loads
"Ypenburg The Hague"'s runways, seems nobody flew there ever :)

fg_os_osgviewer.cxx:
    Any particular reason to not run osg multithreaded as default?

ViewPartitionNode, CameraGroup:
    Small compile fix for a OSG version with float matrices, instead of
double. Tried to compile with float matrices to see if it affects speed, but
the quantization is visible (aprox .5m) and the airplane jitters horribly.

main.cxx:
    While showing the splash screen, limit the frame rate. I was getting
200fps at the splash screen, which is pointless & wasteful, specially on
single-core machines. On multicore one core is pegged at 100%, another is
loading tiles. If you run with VBLANK on, on a fast single-core machine, it
may not matter too much. Anyway, 15Hz redraws should be enough, quite
possibly as low as 5Hz could be acceptable. Older computer owners should
notice a difference.

positioned.cxx:
    I dont know what this was for. I think it was a compile fix. I have some
other changes to the codebase around, had to edit the patch files. Dont
apply if everything else compiles for you :)


 The most important changes are the apt.dat optimization, the logstream
optimization and the splash screen throttling. On this 3Ghz dual core intel
E2160 with hot disk-caches and "--disable-random-objects --disable-sound
--aircraft=ufo" it takes 6 seconds to start loading scenery tiles and 12
seconds to splash screen fade out. Airway loading is >1 second and does
quite a few new/deletes, too. Maybe I´ll take a look at it.


Going forward another big config issue I see is  "--enable-random-objects"
tile loading. It's orders of magnitude slower than with random-objects
disabled. I'll try to take a look at it, but's all the osgDB implementation
and it's big.
Also, the tile loader is not concurrent, only one tile is loaded at a time.
I can start 20 osgDB threads and only one of them will do anything useful.
This is specially noticed with --enable-random-objects. As an interim
solution it should be possible to start some threads to do the random
objects addition after the base tiles have been loaded and displayed, later
adding the subgraphs to the already displaying tiles and using more than one
core to do the heavy random object generation.

regards,
 yon

Attachment: FlightGear - Copy.patch
Description: Binary data

Attachment: SimGear - Copy.patch
Description: Binary data

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to