Jump to content

Iniwrite and Filehandle


Recommended Posts

After a recent topic, I started farting about with .ini files to see if the work with a file handle returned by FileOpen.

They do, but do not seem to be any quicker, and most of the time, slower.

I'm just a little curious as to why this is, if anyone knows?

It seems a lot faster with FileWrite.

Here's the script I used.

$sfile = @ScriptDir & "\test.ini"
;$hfile = FileOpen(@ScriptDir & "\test.ini",1)

Sleep(2000); just to give the interpreter a chance to start up

$timer = TimerInit()
For $i = 0 To 1000
    IniWrite($sfile,$i,$i,$i); Change to $hfile
Next
ConsoleWrite(TimerDiff($timer) & @CRLF)

And my results

I tried more than a few times.

filename = 1948.78538678726

filehandle = 1995.27468244446

EDIT:

I think I used to few writes, I tried with 5000 this time and the results were what I expected.

;filename = 16165.4754829552

;filehandle = 19510.1253164002

EDIT2:

Wait, No, filename was 3 seconds faster :mellow:

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • Developers

Are you sure the INIWrite(FileHandle,,) works?

$sfile = @ScriptDir & "\xxxx1.ini"
$hfile = FileOpen(@ScriptDir & "\xxxx2.ini",1)
Sleep(200); just to give the interpreter a chance to start up
$timer = TimerInit()
For $i = 0 To 1000
    IniWrite($sfile,$i,$i,$i)
    IniWrite($hfile,$i,$i,$i)
Next
ConsoleWrite(TimerDiff($timer) & @CRLF)
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...