LerN Posted July 4, 2017 Share Posted July 4, 2017 (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 July 4, 2017 by LerN Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 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. Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
TheDcoder Posted July 4, 2017 Share Posted July 4, 2017 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 More sharing options...
LerN Posted July 4, 2017 Author Share Posted July 4, 2017 Code of both languages is above bro Link to comment Share on other sites More sharing options...
TheDcoder Posted July 4, 2017 Share Posted July 4, 2017 @LerN No idea what WritePrivateProfileString is or does, is it a custom implementation or is it from a standard library? 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 More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 Would fprintf() be faster than WritePrivateProfileString()? Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 (edited) Remark the WritePrivateProfileString() first to see if that changes the victor. If it does then try something else in it's place. Edited July 4, 2017 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
LerN Posted July 4, 2017 Author Share Posted July 4, 2017 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 Link to comment Share on other sites More sharing options...
TheDcoder Posted July 4, 2017 Share Posted July 4, 2017 Just now, LerN said: Show me your code I don't know a speck of C or C++ 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 More sharing options...
LerN Posted July 4, 2017 Author Share Posted July 4, 2017 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 More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 (edited) I think that I use fprintf(). Let me check my codes rq. Edited July 4, 2017 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 Something like this: fprintf(stderr, "Hello World\n"); Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
LerN Posted July 4, 2017 Author Share Posted July 4, 2017 Is there something like iniwritesection in c++ ? Link to comment Share on other sites More sharing options...
LerN Posted July 4, 2017 Author Share Posted July 4, 2017 btw what did u decleare in stderr Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 (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 July 4, 2017 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
junkew Posted July 4, 2017 Share Posted July 4, 2017 Your comparison is not equal filewrite you should compare with fprintf or stringstreams ini file writing you should compare with https://www.autoitscript.com/autoit3/docs/functions/IniWrite.htm filewriting ini files will be normally much faster then the WritePrivateProfileString Win32 API's 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() Xandy 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 Good stuff. Thank you junkew. Maybe I'll play C++ again for the next couple of days. Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
LerN Posted July 4, 2017 Author Share Posted July 4, 2017 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 Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 (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 July 4, 2017 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2017 Share Posted July 4, 2017 (edited) This may help: https://stackoverflow.com/questions/3200117/what-are-cerr-and-stderr We could probably just fopen() a file anyhow. Edit: and fclose() Edited July 4, 2017 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now