On 8/10/11 9:16 AM, Ted Roche wrote:
> First pass on an old Pentium-M machine and VFP 7 yields:
>
> Lines: 5294
> Characters: 157296
> Elapsed: 0.050
>
> Bear in mind that VFP is atrocious at benchmarking fractions of a
> second. I believe the accuracy is around 1/50th of second.

I tweaked it to match as closely as possible the variable names from the Python 
script for comparison. Here's a single result running it on VFP8 on XP in a 
virtual 
machine on my 5-year old MacBook:

lines, chars:   5294    157296
elapsed:        0.020

Here's a single result running the Python script on my overworked and aging 
Ubuntu 
server with Python 2.5.1:

chars, lines: 162590 5294
elapsed: 0.00382995605469 seconds.

The discrepancy in chars is exactly the # of lines, so I think the python 
script must 
be counting the new line character while the vfp script is not.

As mentioned by others, benchmarking such a tiny thing is pointless. What 
catches my 
eye is the relative simplicity of the Python code. Theres a Unix utility called 
'wc', 
which counts lines, words, and characters in a file. Here's the output on each:

root@sg25:/var/www/paulmcnett.com/vfp_python_smackdown# wc count_lines.prg
  14  45 291 count_lines.prg
root@sg25:/var/www/paulmcnett.com/vfp_python_smackdown# wc count_lines.py
  12  36 227 count_lines.py

The Python script has 15% fewer lines, 20% fewer words, and 22% fewer 
characters. 
Again, probably a useless comparison for such a tiny script, but I've found the 
simplicity of Python syntax compared to other languages to be one of its 
greatest assets.

Paul

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to