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: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

speed of LOCATE command in X# vs VFP

Post by Chris »

Hi Loy,

This extreme difference is because of the caching VFP does in this case. If we adjust the RDD in X# to also keep the data in memory instead of reading it always from disk, of course the speed will be also greatly improved.

But still, indeed there's a relatively large difference also without this caching. Some of that, I am sure it is because X# is managed code, while VFP uses pure Win32 file access etc, also X# works in a unicode environment while VFP doesn't, so some (larger or smaller) speed difference will always exist, it's the price to pay for having otherwise general progress. I mean for example the Windows OS is A LOT slower than what MS DOS was 25 years ago, but that does not mean anybody (well, almost anybody :)) would want to go back to the DOS days...
Chris Pyrgas

XSharp Development Team
chris(at)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 »

Loy,

This XSharp example takes just under 2 minutes on my computer. The same example in VO runs for 4 seconds. This is, of course, a huge difference. I would even say unacceptable.

P.S. If you redirect the file stream into memory in XSharp, then the example takes 8 seconds.

Best regards,
Leonid
Best regards,
Leonid
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

speed of LOCATE command in X# vs VFP

Post by leon-ts »

At the moment, I have already managed to transfer a large amount of code from VO to XSharp and there is already one small fully working application that has been sent to production. Therefore, I can already conclude about the performance of XSharp (managed) vs VO (native). There are sections of code that work in a comparable manner, and there are sections that work 30% slower in XSharp compared to VO. But there are even some that now work faster in a new (transported) application. But for this, I made changes to the code, bringing it closer to a more appropriate NET environment. In total, the application works at an acceptable speed, not much worse than in VO. And its separate functionality is even more stable and faster than in VO.

At the same time, my team and I received:
- modern development environment (Visual Studio 2019)
- powerful NET language XSharp
- improved teamwork with projects via git (built into VS)

But, again, the 30x difference between VO and XSharp in this particular example you gave is unacceptable. I think we need to ask the XSharp team to deal with this problem in the XSharp RDD subsystem.

Best regards,
Leonid
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 »

So the case is different in VFP/X#, it looks like VO/X# performs a little bit better.

I tried to redirect the file stream into memory in VFP/X# and the difference is not much (minus 2-3 seconds).

I don't use VO/X# so I can't compare.
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

speed of LOCATE command in X# vs VFP

Post by leon-ts »

Loy,

I ran your example in XSharp exactly as you did with the VFP dialect enabled. I uncommented the line

Code: Select all

FConvertToMemoryStream(DbInfo(DBI_FILEHANDLE))
and this example in my VFP/X # completed in 8 seconds.

And only later I wondered how it would work in VO and ran this test in VO too.

Best regards,
Leonid
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 »

Hmmm, yours is faster at 8 seconds? Is this the "SKIP" example? or the "LOCATE" example. The 8 seconds for me is the "LOCATE" example.
But on the "SKIP' example, see my attached screenshot here with FConvertToMemoryStream(DbInfo(DBI_FILEHANDLE)) enabled.
Attachments
screen.JPG
screen.JPG (40.25 KiB) Viewed 692 times
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

speed of LOCATE command in X# vs VFP

Post by leon-ts »

Loy,

With FConvertToMemoryStream(DbInfo(DBI_FILEHANDLE)) enabled my results (your tests) are as follows
LOCATE: 1 sec
SKIP: 8 sec

If FConvertToMemoryStream(DbInfo(DBI_FILEHANDLE)) disabled (commented) my results (your tests) are as follows
LOCATE: 8 sec
SKIP: ~2 min
Attachments
Test 2020-08-18 202442.png
Test 2020-08-18 202442.png (63.31 KiB) Viewed 692 times
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 »

I forgot to mention that I have 1000 records in my TEMP.DBF. When I reduced this to 100 records, I have the same result as yours.
leon-ts
Posts: 435
Joined: Fri Feb 03, 2017 1:43 pm

speed of LOCATE command in X# vs VFP

Post by leon-ts »

Loy,

My temptab.dbf file has two fields ([SERIES] N,8 and [NAME] C,100) and 1000 records.
Attachments
temptab.dbf.rar
(2.92 KiB) Downloaded 84 times
Best regards,
Leonid
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

speed of LOCATE command in X# vs VFP

Post by Chris »

Guys, as Robert said, this problem is indeed already acknowledged and will be looked at!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply