Performance issues variable VS file
Posted: 20 Feb 2012 12:02
'
Trying to figure out the best way to throw help on the console
Using a variable is easy, but it wastes memory
So I try some clever file enum trick
But now it wastes 60secs to process a file of +-18.000 lines I want to reduce memory load and have it fast
I was also thinking about a solution where I initially load the help variables and when the loading is done, write them out to a help file that can be smaller and searched more easily.
Trying to figure out the best way to throw help on the console
Using a variable is easy, but it wastes memory
Code: Select all
set ^"$Usage.%$defines%=^
use: ( %%%$defines%%% #vr, #fullPathFile, #section, #key, #sErr,0 )%$n1c%
con: contents of $key%$n1c%
err: Unaffected, panic otherwise"
Code: Select all
:: ------------------------------------------------------------------------------------------
set "$defines=File.readINI_" &set "$details=ini file handler"
:: ------------------------------------------------------------------------------------------
:: last updated : 18/02/2012
:: support : naDelayed, delayedChars, related chaining
::
:H use: ( %$defines% #vr, #fullPathFile, #section, #key, #sErr,0 )
:H con: contents of $key
:H err: Unaffected, panic otherwise
::
Code: Select all
set "$Debug.Use=File.readINI_"
for /f "delims=[]" %%? in (
'type "!$DOS-KIT.fullPathFile!" ^|find /v /n "type" ^|find "$defines=%$Debug.Use%"'
) do set "$start=%%?"
for /f %%? in (
'type "!$DOS-KIT.fullPathFile!" ^|find /c /v ""'
) do set "$end=%%?"
set "$start"
set "$end"
< "!$DOS-KIT.fullPathFile!" ( set "$at=0"
for /l %%ç in (
1, 1, !$end!
) do set "$=" &set /p "$=" &if %%ç geq !$start! if defined $at if "!$:~0,3!" == ":H " (
set "$at=1" &for %%? in ( "!$:~3!" ) do call set "$=%%~?" &echo( !$!
) else if !$at! neq 0 set "$at="
)
Code: Select all
$start=17428
$end=18430
use: ( File.readINI_ #vr, #fullPathFile, #section, #key, #sErr,0 )
con: contents of $key
err: Unaffected, panic otherwise
endoftest Druk op een toets om door te gaan. . .
I was also thinking about a solution where I initially load the help variables and when the loading is done, write them out to a help file that can be smaller and searched more easily.