Jump to content
Sign in to follow this  
JohnOne

Iniwrite and Filehandle

Recommended Posts

JohnOne

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.

Share this post


Link to post
Share on other sites
Jos

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.