Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#1462 closed Feature Request (Completed)

Need speedup FileReadLine() and FileWriteLine() functions

Reported by: Suppir Owned by:
Milestone: Future Release Component: AutoIt
Version: Severity: None
Keywords: FileReadLine, FileWriteLine Cc:

Description

AutoIt has a real bad (or none?) buffering while writing or reading files line by line.

Look at this code AutoIt code:

#include <Timers.au3>
Global $starttime = _Timer_Init()
Global $OUT = FileOpen("test.txt", 2)

For $x = 1 to 1000000 Step 1
    FileWriteLine($OUT, "Some text 1234567890")

Next
MsgBox(0, "", _Timer_Diff($starttime))

And look at this Perl code:

use Benchmark;

open (OU, ">test.txt");
$t0 = new Benchmark;
for (1 .. 1000000){
	print OU "Some text 1234567890\n"
}

$t1 = new Benchmark;
$td = timediff($t1, $t0);
print "the code took:",timestr($td),"\n";
<>

Perl writing lines in file 10 times faster

The same with reading files line by line with FileReadLine(). That is because Perl(and Python, Lua, etc) uses smart buffering while writing or reading data from disc.

We really need to improve perfomance of AutoIt in this very-often-used functions!

Attachments (0)

Change History (10)

comment:1 by TicketCleanup, 16 years ago

Version: 3.3.5.3

Automatic ticket cleanup.

comment:2 by Jon, 16 years ago

FileReadLine is buffered btw.

Are you sure this isn't just AutoIt being slower than perl in general and nothing to do with FileWrite?

comment:3 by Jon, 16 years ago

Also, AutoIt will be internally converting the default UTF16 text into ANSI for output which will impact performance (I'm guessing that perl works just in ANSI). Try changing the output text file to UTF16-LE for a format that requires no conversion.

comment:4 by anonymous, 16 years ago

I'm sure. I've trying to do a regex' search & replace in text files.
If we put text file in one variable, then AutoIt speed is equal Perl speed.
But if we are working line by line (reading files & writing to file) that AutoIt 10 times slower.

comment:5 by Suppir, 16 years ago

I think, the problem in that fact that AutoIt writes to disc each time these functions are being used. While Perl reads/writes to hard disc with portions.

If we use functions FileReadLine(), FileWriteLine() in loop, the speed are extremely slowing down. We could read file in one variable, but it doesn't work with big files, and it doesn't work if we're going to do some tight work with lines.

comment:6 by Suppir, 16 years ago

*In both cases I used standart ANSI files*

comment:7 by Jon, 16 years ago

Resolution: Completed
Status: newclosed

I've rewritten some of the FileWriteLine() code and it's about 40-50% faster than it was. The OS cache is used for caching and that's not something that will be changed. Any speed differences now should just be because perl is probably faster anyway...

comment:8 by TicketCleanup, 16 years ago

Milestone: Future Release

Automatic ticket cleanup.

comment:9 by Suppir, 16 years ago

And what about FileWriteLine()?
But many thanks anyway!

comment:10 by anonymous, 16 years ago

I mean FileReadLine()

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.