Jump to content

Recommended Posts

Posted (edited)

Guess what ? 
today i made a small comparison between c++ and autoIt ... in writing this text into .ini file
[Section]
Key = Hello world 

Here's the code :
 

;autoit :
for $i = 1 to 10000
    FileWrite("TestFromAu3.ini","[Section]"&@CRLF&"Key2 = Hello World"&@CRLF)
    Cout($i & @CRLF)
Next

;C++
int main()
{
    for (int counter=0;counter<10000;counter++){
    WritePrivateProfileString("Section \n", "Key 2", "Hello World", ".//test.ini");
    cout << counter << endl;
    }
    return 0;
}

Guess what was the result ?
the result autoit wrote this text in 1:16 ( 1 minutes and 16 seconds )
the result c++ wrote this text in 1:47 ( 1 minutes and 47 seconds )

Is that real ? i still can't understand that autoit won on c++ ? lol
if u don't trust me i can make a video

Edited by LerN
Posted
Just now, TheDcoder said:

@LerN No idea what WritePrivateProfileString is or does, is it a custom implementation or is it from a standard library?

Show me your code

Posted
Just now, Xandy said:

Remark the WritePrivateProfileString() first to see if that changes the victory.  If it does then try something else in it's place. :)

What could i try instead ?

Posted (edited)
23 minutes ago, LerN said:

btw what did u decleare in stderr

I think you can use stdout too.

If you mean what did I #include  It is one of these:

#include <stdlib.h>
#include <io.h>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include "arrayclass.h"

Not arrayclass.h oops.  I'll have to make a smaller project and get used to my new compiler to figure it out.  My new compiler isn't separating the error and warnings messages and it's a mess.

I could be wrong b/c I have never tested it but I have always felt that ini reading; scanning for labels then returning datas, was going to be slower then sequential read / writes.

Edited by Xandy
Posted

Your comparison is not equal

Long ago it was implemented like this in AutoIt .

void AutoIt_Script::IniWrite(VectorVariant &vParams, Variant &vResult)
{
    char    szFileTemp[_MAX_PATH+1];

    // Get the fullpathname (ini functions need a full path) 
    Util_GetFullPathName(vParams[0].szValue(), szFileTemp);


    if (WritePrivateProfileString(vParams[1].szValue(), vParams[2].szValue(), vParams[3].szValue(), szFileTemp))
  WritePrivateProfileString(NULL, NULL, NULL, szFileTemp);  // Flush
    else
  vResult = 0;       // Error, default is 1

} // IniWrite()

 

 

 

Posted

Xandy i mean  fprintf(stderr,"hello world \n");
i mean stderr what does is stands for ? or i mean what it's declared for idk how to expalin xd

Posted (edited)

stderr used to write to a file years ago with different compiler.

Currently stderr is only writing to console and that maybe b/c I created a console application.

I used to be able to write to stderr and program would create a new blank file at the start of each run.  I'd keep a log there.  I'll have to look into how this is done these days.

Edited by Xandy

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
  • Recently Browsing   0 members

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