LerN

Autoit vs C++ ? Who won ?

28 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



#2 ·  Posted

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.


I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#3 ·  Posted

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)


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

#4 ·  Posted

Code of both languages is above bro 

Share this post


Link to post
Share on other sites

#5 ·  Posted

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


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

#6 ·  Posted

Would fprintf() be faster than WritePrivateProfileString()?


I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#8 ·  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

Share this post


Link to post
Share on other sites

#9 ·  Posted

Just now, LerN said:

Show me your code

I don't know a speck of C or C++


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

#10 ·  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 ?

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

I think that I use fprintf().  Let me check my codes rq.

Edited by Xandy

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#12 ·  Posted

Something like this: fprintf(stderr, "Hello World\n");


I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#13 ·  Posted

Is there something like iniwritesection in c++ ?

Share this post


Link to post
Share on other sites

#14 ·  Posted

btw what did u decleare in stderr

Share this post


Link to post
Share on other sites

#15 ·  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

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#16 ·  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()

 

 

 

1 person likes this

Share this post


Link to post
Share on other sites

#17 ·  Posted

Good stuff.  Thank you junkew.  Maybe I'll play C++ again for the next couple of days.


I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

#18 ·  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

Share this post


Link to post
Share on other sites

#19 ·  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

I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

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