For large files the ReadLn is noticeable slow and thus I needed to find another way to read large files (in my case a 22GB csv file).
My results:
test1: 24.267s
test2: 3.951s
Code: Select all
Let>FILE_PATH=C:\path\to\huge\file\test.csv
Let>ROW_TO_READ=7713125
Timer>START
ReadLn>FILE_PATH,ROW_TO_READ,TEMP_row
Timer>END
Let>DURATION_test1={(%END%-%START%)/1000}
//PS start with index 0
Let>ROW_TO_READ=ROW_TO_READ-1
Timer>START
Let>RP_CAPTURESTDOUT=1
Let>POWERSHELL_COMMAND=[Linq.Enumerable]::ElementAt([System.IO.File]::ReadLines('%FILE_PATH%'), %ROW_TO_READ%)
RunProgram>cmd /c chcp 65001 > nul & cmd /c PowerShell -Command " & {%POWERSHELL_COMMAND%}"
Let>RP_CAPTURESTDOUT=0
Timer>END
Let>DURATION_test2={(%END%-%START%)/1000}
MDL>test1: %DURATION_test1%s%CRLF%test2: %DURATION_test2%s
/*
test1: 24.267s
test2: 3.951s
*/
BUT! ReadLn is faster than the PS way for line number < 26000