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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.