Modify

Opened 9 years ago

Closed 9 years ago

Last modified 9 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 Changed 9 years ago by TicketCleanup

  • Version 3.3.5.3 deleted

Automatic ticket cleanup.

comment:2 Changed 9 years ago by Jon

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 Changed 9 years ago by Jon

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 Changed 9 years ago by anonymous

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 Changed 9 years ago by Suppir

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 Changed 9 years ago by Suppir

*In both cases I used standart ANSI files*

comment:7 Changed 9 years ago by Jon

  • Resolution set to Completed
  • Status changed from new to closed

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 Changed 9 years ago by TicketCleanup

  • Milestone set to Future Release

Automatic ticket cleanup.

comment:9 Changed 9 years ago by Suppir

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

comment:10 Changed 9 years ago by anonymous

I mean FileReadLine()

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.