I'm working on a script that should parse a group of text files each 5 seconds. (Each file in the group should be checked against the existence of specific string, somewhere in the middle.)
Consider this group as 5 files, each 200 lines, each line is 200 characters. The files are UTF-8.
It is OK, from the performance point of view, to use FileRead?
It is OK, from the performance point of view, to use file-reading loop?
(I ask about both because I'm not sure which options will be better for my case.)
Also, what about 10 files?
The performance of the parsing of file contents
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
Discuss Autohotkey related topics here. Not a place to share code.
Re: The performance of the parsing of file contents
Try some benchmark tests. E.g. try each technique hundreds/thousands of times, and use A_TickCount before and after.
FileRead should be better, read once, do InStr once.
With the loop, you need to do InStr on every line. And loops are a key thing which can slow AutoHotkey down, although 200 iterations shouldn't be too bad.
FileRead should be better, read once, do InStr once.
With the loop, you need to do InStr on every line. And loops are a key thing which can slow AutoHotkey down, although 200 iterations shouldn't be too bad.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: The performance of the parsing of file contents
@jeeswg
> Try some benchmark tests.
Yeah, it's all about benchmark tests. The question is: how to perform them properly. I'm not sure.
> E.g. try each technique hundreds/thousands of times, and use A_TickCount before and after.
The problem is that I'm trying to check the load on RAM and CPU. Not the speed of the script.
It seems I can check RAM through Task Manager (taskmgr.exe) quite precisely. Monitoring of CPU is much harder. (It seems that Task Manager is nearly useless for the second task.)
(Btw, now I can say that I need FileRead, not file-reading loop.)
> Try some benchmark tests.
Yeah, it's all about benchmark tests. The question is: how to perform them properly. I'm not sure.
> E.g. try each technique hundreds/thousands of times, and use A_TickCount before and after.
The problem is that I'm trying to check the load on RAM and CPU. Not the speed of the script.
It seems I can check RAM through Task Manager (taskmgr.exe) quite precisely. Monitoring of CPU is much harder. (It seems that Task Manager is nearly useless for the second task.)
(Btw, now I can say that I need FileRead, not file-reading loop.)
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 8 guests