Jump to content

Autoit vs C++ ? Who won ?


Recommended Posts

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
Link to comment
Share on other sites

Yeah but try reading pixels from the screen area in AutoIt verse C++ or setting pixels.

I can draw like 2..3 tile layers in AutoIt (Rotating presets for the 3rd).  I can draw so many more tile layers in C++.  Like 4..12 and not even blink an eye over it.

Link to comment
Share on other sites

44 minutes ago, LerN said:

Is that real ? i still can't understand that autoit won on c++ ? lol

Either your C++ code is bad or there is a bottleneck on your computer (like an antivirus)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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()

 

 

 

Link to comment
Share on other sites

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
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...