speed of LOCATE command in X# vs VFP

This forum is meant for questions about the Visual FoxPro Language support in X#.

User avatar
Chris
Posts: 4905
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

speed of LOCATE command in X# vs VFP

Post by Chris »

Robert,

Caching was what I also thought is the basic difference at first, but then tried with a single iteration in a huge file, so in uncached data, and still the difference is very big compared also to VO, not only FoxPro. I have been preparing a sample and will log it in a minute.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

speed of LOCATE command in X# vs VFP

Post by robert »

Matt,

SQLExec() results are already in memory. So this should give no problems.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

speed of LOCATE command in X# vs VFP

Post by robert »

Chris,

If I remember correctly then VO caches things differently from what we do at this moment. I remember that there was a special "cache manager" in the runtime.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Zdeněk Krejčí
Posts: 19
Joined: Wed Sep 04, 2019 8:07 am

speed of LOCATE command in X# vs VFP

Post by Zdeněk Krejčí »

I would like to note that the LOCATE command in VFP uses Rushmore optimization when possible
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

speed of LOCATE command in X# vs VFP

Post by robert »

Zdenek,

We know that, but the example given does not have any indexes so no Rushmore optimization.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

speed of LOCATE command in X# vs VFP

Post by robert »

Gerhard,

SuspendNotification() and ResetNotification() are handled at the DbServer level.
The example uses workareas / cursors directly

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Loy2888
Posts: 14
Joined: Thu Jul 30, 2020 5:46 pm

speed of LOCATE command in X# vs VFP

Post by Loy2888 »

Hi Robert/Chris,

I tried to add

Code: Select all

FConvertToMemoryStream(DbInfo(DBI_FILEHANDLE))
but it only reduced to 6 seconds from 8 seconds. Still slow compared to FoxPro at less than 1 sec.

The reason why the speed is a big deal for me is that I have a real-time system that constantly collects (in endless loop) live status, attributes, locations, positions, etc.. of a certain moving parts on a 20 different tables that are pretty small with less than 1k of records each and index files are not even needed since LOCATE in FOXPRO is fast enough to return the real-time info.

If I run this code in X#, the delay is adding up, and the result is nothing but a delayed information.

I hope this needs to be considered as I have a positive outlook towards X# moving forward.

Loy
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

speed of LOCATE command in X# vs VFP

Post by robert »

Loy,

We will certainly look at this.
But I have to tell you that our first priority was and is to add all the features and make your apps work. Improving performance is not priority 1. That does not mean that we will not look at this though.


Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

speed of LOCATE command in X# vs VFP

Post by leon-ts »

Hi all,

I was interested in this topic.
Run Loy's example on my computer (several runs to get the average). The test was completed in 10 seconds.
Next, I applied Robert's recommendation with loading the stream into memory.

Code: Select all

FConvertToMemoryStream(DbInfo(DBI_FILEHANDLE))
The test was completed in 1 second.

P.S. I am developing VO/XSharp applications (not a VFP developer). But I take optimizations and application performance very seriously. Therefore, this topic is interesting to me.
Best regards,
Leonid
Loy2888
Posts: 14
Joined: Thu Jul 30, 2020 5:46 pm

speed of LOCATE command in X# vs VFP

Post by Loy2888 »

Hi Leon,
Thanks for being interested on this topic as I am taking application performance very seriously as well. I have applications with heavy lifting algorithms and haven't tried them yet in X# as I came across this performance issue.

Would you mind to test this code as well, it's just the speed of SKIP command for 10 million records, you don't need to create a table with 10 milion records, just a small table will do and go top when eof() see code below:

Code: Select all

? "Start: " + Time()
USE "C:TEMPTemp.DBF" SHARED
//FConvertToMemoryStream(DbInfo(DBI_FILEHANDLE))
SELECT TEMP
GO TOP
FOR VAR lnSERIES = 1 TO 10000000
    SKIP
    IF EOF()
        GO TOP
    ENDIF
NEXT
? "  End: " + Time()
I run this code in X# and it is taking forever, I mean "forever" when it exceeds more than 2 minutes...

In native FOXPRO, running the same code took only 1 second, 2 seconds is the most...

@Robert,

I understand you have more priorities adding all the features in a dialect, but in my opinion, as a developer, I look first at the speed and performance before I continue. All the features can wait. I know you will eventually fix this but most serious developers with database intensive driven applications like to see the performance before they can continue.

I introduced X# to my colleagues showing its cool features and they were very impressed at first, but when we tested X# (using our existing applications) its speed and performance in terms of accessing a table and comparing it to native FoxPro, we were kind of "hmmm... not sure about this".. Anyway, I told them to hold their breath as the X# team is working on it but not the priority right now. :)

Loy
Post Reply