Jump to content
The simFlight Network Forums

Reading variable in Delphi7 is too slow


Recommended Posts

Hello. I try to read 1 byte from offset $04F0 cycling with delay 40 milliseconds. I get this value of spend time (second:millisecond). Is this normal?

00:016

00:015

00:000

00:015

00:016

00:031

00:031

00:016

00:032

00:031

To Peter Dowson:

I know that you have not worked with Delphi.

Link to comment
Share on other sites

Hello. I try to read 1 byte from offset $04F0 cycling with delay 40 milliseconds. I get this value of spend time (second:millisecond). Is this normal?

Depends entirely on your system. I assume you are running an external EXE program? Each time you make a request there's a message posted to FS, a process switch, and eventually the message gets to FSUIPC which then responds. Some things are faster than others in FS itself, depending what has to be done to get the information.

Once FSUIPC has provided the data and thinks it has returned the data, there's another process switch. The time when your program sees it depends on when Windows gives your process any processor time again. Process switching itself can take milliseconds sometimes -- use Task Manager to see how many processes are running at any one time. The main overhead is in message queuing and process switching.

The data quantity is almost irrelevant. You always want to do all the reads and writes in one batch, one "FSUIPC_Process" call. It should be easy to match a reasonable frame rate in FS -- certainly the 25 fps your 40 mSec cycle should be easily achievable, assuming the FS frame rate is around 25 fps too. But of course everything also depends on the loading on your PC -- FSX is very different to FS9, in particular.

Regards

Pete

Link to comment
Share on other sites

Pete, i have Xeon X5450@ 3.0 GHz, 4GB RAM, GeForce GTX280 and FS9 system...

So? I have a water-cooled i7-980X 4.65GHz 6Gb triple port RAM at 2000MHz, an overclocked water-cooled GeForce GTX 480 and FSX. What is the relevance?

The actual processing time for any request in FSUIPC very rarely takes even as much a 1 mSec, on any system, There really isn't much it has to do. Everything else is Windows and other processes and threads.

Yes, I run external EXE and wish to record some parameters.

Okay. Go ahead.

You might also want to consider Lua. There's already an example of a Lua plug-in for recording parameters to a CSV file. It's provided in the Lua package installed with FSUIPC. The plug-in method has the advantage of running in-process and therefore not suffering any process switching nor memory mapped file overheads.

Pete

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.