CXA001 Posted July 26, 2016 Report Share Posted July 26, 2016 I have a question regarding grouping and / or requesting data from FSUIPC and performance. Lets say I have a timer that every 5 seconds queries FSUIPC. As far as performance, is it better to request all the information at the begining of my process: FSUIPCConnection.Process(new string[] { "FSUIPCParkingBrake", "FSUIPCOnGround", "FSUIPCGroundAltitude", "etc..." }); or would it be better to request it as needed through out my code: FSUIPCConnection.Process(new string[] { "FSUIPCParkingBrake" }); Some code... FSUIPCConnection.Process(new string[] { "FSUIPCPOnGround" }); Some code... FSUIPCConnection.Process(new string[] { "FSUIPCGroundAltitude" }); Normally with a database, I would query everything at once as you need to create the connection, run the query, then close the connection, etc. As FSUIPC is always connected, I am curious as to what is the most efficient way to do this. Marc Link to comment Share on other sites More sharing options...
Pete Dowson Posted July 26, 2016 Report Share Posted July 26, 2016 Since calling FSUIPC via the Process request involves your program's process being suspended, and FS effectively "interrupted" (well, another message to process, which gets passed on to FSUIPC), and then another action by the operating system to resuscitate your process, it is generally much more efficient to group your data requirements so that there's only one batch to process. Unless your Process call includes Writes to Offsets which invoke some sort of action in FS, the processing of a batch takes almost no more time for more data or less. It's pretty much just memory copying. Anyway, with only a 5 second polling rate, such performance considerations are negligible. There are programs which request hundreds of data items at a time every 20 milliseconds or even more often -- then it becomes much more significant! You can test these sorts of performance things yourself using the supplied FSInterrogate2 utility (in the FSUIPC SDK). You can batch select a large number of items and have it retrieve them continuously in quite a tight loop. See how much data can be continually requested this way before the affect on FS performance becomes noticeable. And in performance terms it doesn't matter whether you leave it connected or not -- but always leave it connected if you expect to make another request: only disconnect when you no longer need any more updates for your current session -- OR when you get a timeout and need to keep trying to reconnect (eg over an FS crash, or some inordinately long delay in FS). Pete Link to comment Share on other sites More sharing options...
CXA001 Posted July 29, 2016 Author Report Share Posted July 29, 2016 Thanks Pete for the great explanation. Reworked things a little bit and I am happy with the results. Regards, Marc Link to comment Share on other sites More sharing options...
vgmarimon Posted August 26, 2016 Report Share Posted August 26, 2016 Hi, our software for tracking flights in Vueling VA made by me, i process data every 500ms... ALL VARIABLES(40 o 50) without loosing performance.... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now