Tony Peden writes: > I know the preferred method of supplying data to properties is by > binding or tying the properties to C++ methods.
Actually, I've come to the conclusion that it's best just to leave them in the property tree whenever possible, and to bind only where necessary. A lot of stuff, such as control positions, doesn't really need to live in any C++ variable. Since you're copying data from JSBSim to FlightGear anyway, it shouldn't make much difference whether you copy it into the property tree or into a C++ variable. I > Right now, I'm avoiding the question altogether and using the pointer > and copy technique. This is not as efficient as binding and requires > a data member for each property in FGJSBSim, so its something I'd like > to get away from doing. Yes, that is an annoyance. Andy Ross just punted the whole question by using the fg(Get|Set)* methods directly, without saving pointers, arguing (reasonably enough) that any extra overhead gets lost during the wait for the graphics hardware to be ready for the next frame. To test this assumption, I hacked my copy of FlightGear to loop through property accesses multiple times and watched the framerate. Here's what I got, using the lower value whenever the framerate fluctuated: 1. No extra accesses: 44fps 2. 500 SGPropertyNode pointer accesses per frame: 43fps (2.3% slowdown) 3. 500 fg(Get|Set)* accesses per frame: 42fps (4.5% slowdown) 4. 1,000 SGPropertyNode pointer accesses per frame: 42fps (4.5% slowdown) 5. 1,000 fg(Get|Set)* accesses per frame: 40fps (9% slowdown) 6. 10,000 SGPropertyNode pointer accesses per frame: 27fps (39% slowdown) 7. 10,000 fg(Get|Set)* accesses per frame: 22fps (50% slowdown) The surprise here is that most of the loss comes not from the map lookup (which is skipped by the SGPropertyNode pointer access) but from the SGPropertyNode::getValue itself: at 10,000 accesses, the first 39% of the overhead comes from getValue, and only the remaining 11% from the map lookup. That's just wrong, but it's also good news, because the map lookup should be easy to fix -- I'm doing a profiling build now to help me hunt down the problem. So far, we're making far fewer than 500 property lookups per frame, so there is no noticable drop, and you may be just as well off using fg(Get|Set)* directly for now. All the best, David -- David Megginson [EMAIL PROTECTED] _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel