Before I post my code, is there anyone who is familiar with C++ enough to help me with optimization of performance of a Windows utility program I wrote?
This is a discussion on C++ Optimization within the Off Topic forums, part of the Entertainment category; Before I post my code, is there anyone who is familiar with C++ enough to help me with optimization of ...
Page: 1
Before I post my code, is there anyone who is familiar with C++ enough to help me with optimization of performance of a Windows utility program I wrote?
C++ is an evil... evil bitch
very true, though it does have some advantages
Points of interest:
*****printf() vs cout vs ostream
*****clock()
Code:// Author: Erick Yeagle, Planet Development // Date: 11/21/2008 // File: sw.cpp // Description: Utility that displays execution time of parameter commands // Version: 1.0 //******Time properly displayed in format: [minute]m[seconds].[milliseconds]s // // Copyright (C) 2008, Erick Yeagle //******This program is free software. You can redistribute it and/or modify //******it under the terms of the GNU Public License, as published by the Free //******Software Foundation. // //******This program is distributed in the hope that it will be useful, but //******WITHOUT ANY WARRANTY, and without the implied warranty of MERCHANTABILITY //******or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Public License for more //******details. // //******If you did not receive a copy of the GNU Public License along with this //******program, please visit http://www.gnu.org/licenses #include <ctime> #include <string> using namespace std; int main(int argc, char* argv[]) { ****if (argc==1) { ********printf("%s %s %s\n\n%s%s%s\n%s\n**%s\n**%s\n", ************"Syntax:", argv[0], "\"command\" [command_arguments]", ************"Stopwatch (", argv[0], ".exe), version 1.0", ************"Please refer any comments, concerns, or questions to:", ************"E-mail:** [email protected]", ************"Website:**http://PlanetDevelopment.no-ip.info"); ********return 1; ****} ****string commands; ****for (int x(1); x<argc; x++) { ********commands+=argv[x]; ********commands+=" "; ****} ****double start(clock()); ****int success(system(commands.c_str())); ****double elapsed(clock()-start); ****if (success==0) printf("\n%i%s%.3f%s\n", ********int(elapsed)/(60*CLOCKS_PER_SEC), "m", elapsed/CLOCKS_PER_SEC, "s"); ****return 0; }
erm bro i had bumped a topic in tech for about a month on CSS for websites (probably the easiest form of CSS) and no one even replied to it, you're not going to find help on here, especially in these forums. I'd suggest http://gruntville.com/phpBB2/ my cousin is a part of those guys and they do coding for stanford and stuff, really intelligent people.
How do you people understand how to do this stuff? I went on the website and looked at the tutorial and it looked pretty confusing. Is there classes to learn this stuff other then college courses?
it's pretty easy shit, except i left all the java and stuff cause i wasn't even going into programming, went into biomedicalHow do you people understand how to do this stuff? I went on the website and looked at the tutorial and it looked pretty confusing. Is there classes to learn this stuff other then college courses?[/b]
then answer his question.it's pretty easy shit, except i left all the java and stuff cause i wasn't even going into programming, went into biomedical [/b]
I would if I continued taking the course, but I didn't, so only 2 years of learning it isn't enough I guess.then answer his question.[/b]
never had C++; i can understand the basic stuff because we get lots of java, php, vb.net etc.
but when i read your code i get confused :unsure:
ive had C, and java and others but not C++ i was assumming it would be the same as C but.. no
and yeah i get confused with ur code too lol
Confusing how? Lol
Granted it is written to take the least amount of time, so the verbose forms are not there.
i get the basics of the code lol , its almost same as C
main problem would be, i dont know what the hell that program does XD... or what do you want it to do haha
Changed the printf to cout, since printf is solely C, and to keep with coding standard to not mix C and C++.
The point of the program is to display the time of execution of whatever parameter commands given to it.
Bookmarks