Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP vs Other languages (Python/Ruby)
Message
From
22/05/2011 08:17:52
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01511347
Message ID:
01511389
Views:
87
>>>>>>>Hi All,
>>>>>>>
>>>>>>>Not really a Fox question specifically but thought someone here might have an idea on this.
>>>>>>>
>>>>>>>I am wondering just how code execution speed of VFP compares to other languages such as Python and Ruby? Take for example the following 10million times loop:
>>>>>>>
>>>>>>>nStart = SECONDS()
>>>>>>>a = 0
>>>>>>>b = RAND()
>>>>>>>FOR x = 1 TO 10000000
>>>>>>>	a = a + b
>>>>>>>NEXT
>>>>>>>nStop = SECONDS()
>>>>>>>? nStop-nStart, X, a
>>>>>>>
>>>>>>>
>>>>>>>This runs on my machine in VFP in 2.4secs. Any idea how fast it would run in either of the alternative languages?
>>>>>>>
>>>>>>>Thanks,
>>>>>>
>>>>>>I'm not a process timer guru, but as a brain exercise decided to try your code in VFP 9 and what I think is a similar process in C# on my box -
>>>>>>
>>>>>>i7 cpu 1.73 ghz
>>>>>>6 gb ram
>>>>>>Win 7 64 bit
>>>>>>
>>>>>>Your code in my vfp 9 sp 2
>>>>>>
>>>>>>6.9 to 7.9 seconds on ten tests
>>>>>>using 100,000,000 in the loop - 79.889 seconds
>>>>>>
>>>>>>This is my C# test :
>>>>>>
>>>>>>
>>>>>>
>>>>>>        static void Main(string[] args)
>>>>>>        {
>>>>>>            Random random = new Random();
>>>>>>            int a = 0;
>>>>>>            int b = random.Next();
>>>>>>            Stopwatch stopwatch = new Stopwatch();
>>>>>>            stopwatch.Start();
>>>>>>            for (int i = 0; i < 10000000; i++)
>>>>>>            {
>>>>>>                a += b;
>>>>>>            }
>>>>>>
>>>>>>            stopwatch.Stop();
>>>>>>
>>>>>>            TimeSpan elapsedTime = stopwatch.Elapsed;
>>>>>>            Console.WriteLine(elapsedTime.ToString());
>>>>>>            Console.Read();
>>>>>>        }
>>>>>>
>>>>>>
>>>>>>This does the 10,000,000 loop in .06 seconds.
>>>>>>
>>>>>>It appears your VFP code only generates one random number, so I tried to emulate that. If i move the generation of the random number inside the loop
>>>>>>
>>>>>>a += random.New();
>>>>>>
>>>>>>the whole process takes between .44 and .48 seconds.
>>>>>>
>>>>>>Since I know as a matter of catechism that nothing is faster than the Fox, I am sure my methodology must be flawed, but I find it interesting, nonethless and would welcome explanation.
>>>>>
>>>>>IAC I think you're lucky that a didn't overflow {g}
>>>>
>>>>I'd also be kind of curious as to why my VFP testing was getting 7+ second numbers where Nick got less than 3 ? ( see my specs )
>>>>
>>>>Nick, what are you running?
>>>
>>>
>>>Charles,
>>>
>>>Running on an 18 month old workstation but a reasonably fast one:
>>>Win2003 Server - reasonably clean install
>>>CPU: AMD Phenom II X6 - 2.8Ghz
>>>RAM: 2 x 4Gb DDR3 1600Mhz
>>>
>>>Nick
>>
>>I wonder if there is a performance penalty in VFP running on a 64 bit OS, since my box took about 3 times what yours did in VFP.
>>
>>In any case, I find the C# results interesting. Not sure if they can be extrapolated to anything meaningful as but a difference in the random function doesn't seem to account for it as when there was only addition going on inside the loop C# outperformed VFP even more dramatically. I was frankly surprised ( but I guess glad, since I actually do all my development in .net now <s> )
>>
>>I'd be interested to see other comparisons. I know string handling was touted in VFP as being faster than anything anyone had seen but I'm going to put together some tests comparing that in VFP and C# as well.
>
>
>This has been done to death already - we know C# outperforms VFP in string processing. There are already articles with all the tests out there on the internet. No need to beat that into the ground. A more interesting test imo would be data performance - VFP database vs SQL. And VFP will still have a unique value no matter how much you try to prove .NET is so superior :)

I actually did not set out to prove anything. i was testing out of curiosity and reported the results.

I worked in fox for almost 20 years, made a lot of money with it and in ancient times got a couple of fox MVP goodie bags. But I find it amusing that defending it against a world that has moved on has taken on cult-like status as people dither for a decade over where to go next hoping to find something that can approach the wonders of the magic Fox.

I see very bright people who I have known for years and respect very much in an endless quest to find some language being developed by autistic savants in a cellar in the Carpathian mountains or an ivory tower in a compound in Idaho that will be theoretically perfect and which is probably better than anything Microsoft has ever or could ever develop and is rumored to be on track to have a UI by 2015 but which has a user base of six other people and may at any moment go all eTechnologia on us.

And now the grail of Open Source has become the touchstone, seemingly based on the Infinite Number of Monkeys school of quality control and innovation.

I appreciate the quest as an intellectual exercise, but meanwhile, I have code to write and I like being able to google for solutions, get books from Amazon, and participate in a developer community where enough people are driven by profit that I can count on their being motivated.

As to VFP database vs SQL - I think that ship sailed so long ago that the argument is moot. If one uses DBC and DBFs yes indeed VFP will always have a "unique value" just as a Hawken will always represent "state of the art" in muzzle loading rifles. I treasure my Hawken. I would not recommend it to Seal Team 6.

<s>


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform