>>Hi everybody,
>>
>>I've written some relatively simple method and found that C# execution is about 10 times slower than VFP implementation of the same
>>
>>200 ms. vs. 30 ms.
>>
>>So, I've been trying to somehow optimize that. Part of the method is to return XML string. I've been experimenting with
>>
>>dataTable.WriteXML method and unfortunately it does 2 things which I do not need:
>>
>>1. It inserts < NewDataSet > as the root node - why, I am not asking for dataset.GetXML() so why would it create this artificial node anyway?
>>
>>2. It puts carriage return \r\n after each element which I do not need either.
>>
>>So, I can go back to manual generation of the string I need or do you think that I should still go with either GetXML or WriteXML - I do not see any difference between them if dataset has one table and do 3 replaces to get rid of \r\n and NewDataSet tag?
>>
>>UPDATE. I figured why I was getting that big difference - I was running VFP against local SQL Server while C# against remote database. But after I made the necessary change, VFP is still slightly faster.
>
>And the VFP version could also handle any table structure ?
Yes. At least the ones we use. I went with the string builder solution for generating the XML we need. Right now my C# method performs slightly worse than VFP and that upsets me. I looked at the code if there is an opportunity to optimize but don't see much.
If it's not broken, fix it until it is.
My Blog