Batch command execution times
Posted: 16 Jan 2012 00:55
I have recently done a test with a script that I have written.
It "interpret strings and acts in response" (see my thread a few pages ago) and I did a test with it to see how fast it ran.
I got it to echo the time (echo %time%) and then echo "Hello" 100 times. It then echoed the time again and I calculated the run time.
I did a test with standard batch and I got the time as 3 milliseconds on a slow processor. With this code for interpreting:
I clocked it at 9 seconds on a Pentium 4 2.4ghz Single Core processor and 3 seconds on a Intel Core i5 2.8ghz Quad Core processor.
MY QUESTION:
This code (slightly modified) will be used multiple times in the same batch file and so as it gets longer it will run slower. Is there a way to make it much faster, for example down to less than a second?
Regards,
Rileyh
It "interpret strings and acts in response" (see my thread a few pages ago) and I did a test with it to see how fast it ran.
I got it to echo the time (echo %time%) and then echo "Hello" 100 times. It then echoed the time again and I calculated the run time.
I did a test with standard batch and I got the time as 3 milliseconds on a slow processor. With this code for interpreting:
Code: Select all
@echo off
set "$file=test.txt"
set "count=0"
:loop
set "count=%count% + 1"
set /a count=%count%
for /f "tokens=1,2* delims=: " %%a in ('findstr /n /i "printline" "%$file%"') do (
set "command=%%b"
set "value=%%c"
setlocal enabledelayedexpansion
echo !value!
endlocal
goto :break
)
:break
if "%count%"=="100" (echo %time% & pause >nul)
goto :loop
I clocked it at 9 seconds on a Pentium 4 2.4ghz Single Core processor and 3 seconds on a Intel Core i5 2.8ghz Quad Core processor.
MY QUESTION:
This code (slightly modified) will be used multiple times in the same batch file and so as it gets longer it will run slower. Is there a way to make it much faster, for example down to less than a second?
Regards,
Rileyh