OK folks. Way back in the day, when a Commodore 64 was considered a
powerful computer, people used to say that comments slowed down
interpreted BASICs, and those machines were so slow that it really made
a difference.
Another thing: anybody can create a benchmark program that does not
actually do anything useful. Real world programs that people create
to do useful tasks are something else. File and text processing are
typical batch tasks.
So:
In a folder, I created
10 text files containing the phrase "horse and pony"
I used to convert wmv to avi using TMPGEnc Express 3 or 4. More
recently I have been using VirtualDub, which, theoretically, cannot
handle wmv files but can be fooled into doing so. You have to have
the latest ffdshow software loaded - search for
ffdshow_beta5_rev2033_20080705_clsid.ex e - and then use Notepad to
create a .avs file of the form:
DirectShowSource("C:\Conversions\file.wmv")
- obviously change the path in quotes to fit your path to file.
Open the .avs file in VDub and then you can do a Fast Re-compress,
setting the bit-rate in the XviD or DivX set-up screens to the same as
for the wmv file. I love my horse and pony.
Conversions this way are as good, quality wise as with TMPGEnc but
take a fraction of the time.
Of course, either way, you have to have the XviD and/or DivX codecs
... and 10 text files without the phrase.
I used to convert wmv to avi using TMPGEnc Express 3 or 4. More
recently I have been using VirtualDub, which, theoretically, cannot
handle wmv files but can be fooled into doing so. You have to have
the latest ffdshow software loaded - search for
ffdshow_beta5_rev2033_20080705_clsid.ex e - and then use Notepad to
create a .avs file of the form:
DirectShowSource("C:\Conversions\file.wmv")
- obviously change the path in quotes to fit your path to file.
Open the .avs file in VDub and then you can do a Fast Re-compress,
setting the bit-rate in the XviD or DivX set-up screens to the same as
for the wmv file.
Conversions this way are as good, quality wise as with TMPGEnc but
take a fraction of the time.
Of course, either way, you have to have the XviD and/or DivX codecs
2. Then I created a typical batch file to process all the .txt files in the folder
and show which files contained the phrase.
I created 3 versions
(a) with a typical (I feel) number of REMs, that is, the number I would put in
if I was explaining my ideas to another person.
@echo off
REM Find lines in text files
REM Containing a phrase
REM Store phrase in variable
set phrase=horse and pony
REM Loop through all .txt files in folder
REM Use FIND to check for phrase in each file
set /a foundcount=0
for /f "delims=" %%F in ('dir /b *.txt') do (
type "%%F" | find /I "%phrase%">nul && (
echo Phrase: %phrase% was found in file: %%F
set /a foundcount+=1
)
)
REM Display count of phrases found
Echo found: %foundcount%
(b) with double colons instead of REMs
@echo off
:: Find lines in text files
:: Containing a phrase
:: Store phrase in variable
set phrase=horse and pony
:: Loop through all .txt files in folder
:: Use FIND to check for phrase in each file
set /a foundcount=0
for /f "delims=" %%F in ('dir /b *.txt') do (
type "%%F" | find /I "%phrase%">nul && (
echo Phrase: %phrase% was found in file: %%F
set /a foundcount+=1
)
)
:: Display count of phrases found
Echo found: %foundcount%
(c) with no remarks at all
@echo off
set phrase=horse and pony
set /a foundcount=0
for /f "delims=" %%F in ('dir /b *.txt') do (
type "%%F" | find /I "%phrase%">nul && (
echo Phrase: %phrase% was found in file: %%F
set /a foundcount+=1
)
)
Echo found: %foundcount%
Then I ran them 1, 10, 25, 50 and 100 times each
REM = batch with REM remarks
CLN = batch with double colon remarks
NOC = batch with no remarks at all
1 run - not surprisingly, identical results, as the number of runs
grows, any differences may become apparent...
REM elapsed 3 seconds
CLN elapsed 3 seconds
NOC elapsed 3 seconds
10 runs
REM elapsed 30 seconds
CLN elapsed 34 seconds
NOC elapsed 28 seconds
25 runs
REM elapsed 82 seconds
CLN elapsed 76 seconds
NOC elapsed 75 seconds
50 runs
REM elapsed 154 seconds
CLN elapsed 154 seconds
NOC elapsed 156 seconds
100 runs
REM elapsed 286 seconds
CLN elapsed 313 seconds
NOC elapsed 313 seconds
As you can see, there ain't much in it, and any delay from
remarks is (heavily) swamped by other things.
While all these runs were taking place, my computer being a real
world computer, I was also
-using Mencoder to save a web tv ASF stream into an mpeg file
-using Xnews to download a bunch of binaries from a news server
-using Firefox to browse the web
My PC is a Shuttle ST62K with a 3.0 GHz P4 hyperthreading (Prescott core) with 1 GB RAM and a 7200 rpm IDE HD