wxString performance Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
User avatar
shawnhcorey
Knows some wx things
Knows some wx things
Posts: 34
Joined: Mon Nov 19, 2012 3:29 pm
Location: The Great White North

Re: wxString performance

Post by shawnhcorey » Tue Mar 06, 2018 4:49 pm

Ronald wrote:
shawnhcorey wrote:You should never optimize a program without first profiling it. Without knowing where it is slow, you can spend too much time optimizing the wrong parts.

And you should never optimize a program until users complain it's too slow. Instead, write the program to be easily understood. A professional programmer does not even think about optimization unless they get a change order to speed up a program.
If it can be faster without any loss of clarity of code, why not?
If it works, why fix it?

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3446
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxString performance

Post by ONEEYEMAN » Tue Mar 06, 2018 5:06 pm

Don't touch anything, don't change anything... (C) ;-)

An old programmer joke.

Ronald
Earned some good credits
Earned some good credits
Posts: 133
Joined: Mon Mar 05, 2018 4:17 am

Re: wxString performance

Post by Ronald » Wed Mar 07, 2018 3:09 am

ONEEYEMAN wrote:Yes.
But you missed the first point - did you actually profiled the code?

Maybe the bottleneck is somewhere else?

Thank you.
When I'm learning wxWidgets after Qt, I got this question.
Qt Doc:
Using QStringLiteral instead of a double quoted plain C++ string literal can significantly speed up creation of QString instances from data known at compile time.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3446
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxString performance

Post by ONEEYEMAN » Wed Mar 07, 2018 4:29 am

Hi,
Well, I don't see a question here...

Thank you.

Ronald
Earned some good credits
Earned some good credits
Posts: 133
Joined: Mon Mar 05, 2018 4:17 am

Re: wxString performance

Post by Ronald » Wed Mar 07, 2018 7:01 am

shawnhcorey wrote:
Ronald wrote:
shawnhcorey wrote:You should never optimize a program without first profiling it. Without knowing where it is slow, you can spend too much time optimizing the wrong parts.

And you should never optimize a program until users complain it's too slow. Instead, write the program to be easily understood. A professional programmer does not even think about optimization unless they get a change order to speed up a program.
If it can be faster without any loss of clarity of code, why not?
If it works, why fix it?
For a young project, a better one goes more easily in the future. For an old big project, it's often uneasy to fix. Extra, wxWidgets is a library, be heavily depended on, much harder to fix.

Maybe in the old days, a wxString here seems cool. :)

User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: wxString performance

Post by eranon » Wed Mar 07, 2018 2:17 pm

Ronald wrote:Yes. Considering multi language, wxString makes more sense. I have spent several days in trying MFC, because 1) it is more efficient for machine 2) the controls can be customized seriously, but found that it was not well supported by M$ now any more. I'll check wxWidgets again.
Sincerely, I think you shouldn't choose a toolkit or API (whatever name it's given) because of an assumption about lack of performance in speed on a single class and it's framework of use. Your decision should be done on concrete elements like platform target (are you sure you want to stick with Windows and you will not have to port your code toward another OS in the future?), deadline and goal (e.g. if you have one month to release a draft to convice some investors, you can prefer Pyhton, then migrate to C++ afterward), your background (if you're fluent in C, a direct access to the Win32 API will be always better than the MFC), your convictions (using MFC means being a Microsoft soldier; if tomorrow they give-up the MFC, you'll cry -- the macrosystem is ungrateful)... Thus, the probability that a user will say "Hey! Ronald, you've seen how slow your menu is" is much lower than the one he's surprised your Windows software does not work automatically on his Biiip (of course, you can replace "Biiip" with whatever platform you want: Mac, Android, iOS, etc. - except CP/M).

So, don't worry and go forward ;)
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]

Ronald
Earned some good credits
Earned some good credits
Posts: 133
Joined: Mon Mar 05, 2018 4:17 am

Re: wxString performance

Post by Ronald » Thu Mar 08, 2018 11:54 am

eranon wrote:
Ronald wrote:Yes. Considering multi language, wxString makes more sense. I have spent several days in trying MFC, because 1) it is more efficient for machine 2) the controls can be customized seriously, but found that it was not well supported by M$ now any more. I'll check wxWidgets again.
Sincerely, I think you shouldn't choose a toolkit or API (whatever name it's given) because of an assumption about lack of performance in speed on a single class and it's framework of use. Your decision should be done on concrete elements like platform target (are you sure you want to stick with Windows and you will not have to port your code toward another OS in the future?), deadline and goal (e.g. if you have one month to release a draft to convice some investors, you can prefer Pyhton, then migrate to C++ afterward), your background (if you're fluent in C, a direct access to the Win32 API will be always better than the MFC), your convictions (using MFC means being a Microsoft soldier; if tomorrow they give-up the MFC, you'll cry -- the macrosystem is ungrateful)... Thus, the probability that a user will say "Hey! Ronald, you've seen how slow your menu is" is much lower than the one he's surprised your Windows software does not work automatically on his Biiip (of course, you can replace "Biiip" with whatever platform you want: Mac, Android, iOS, etc. - except CP/M).

So, don't worry and go forward ;)
MFC is not well supported by M$ now, but I can do nothing. For wxWidgets, I might make a pull request. I'm going to learn wxWidgtes. Thanks, best wishes.

User avatar
marcelinux
Knows some wx things
Knows some wx things
Posts: 40
Joined: Thu Nov 07, 2013 9:59 pm
Location: Madrid, Spain

Re: wxString performance

Post by marcelinux » Thu Mar 08, 2018 3:38 pm

The C++ programming language
Chapter 6.
Expressions and Statements

Premature optimization
is the root of all evil.
– D. Knuth

On the other hand,
we cannot ignore efficiency.
– Jon Bentley
I just need learn a little bit more. Thank you for your help.

Ronald
Earned some good credits
Earned some good credits
Posts: 133
Joined: Mon Mar 05, 2018 4:17 am

Re: wxString performance

Post by Ronald » Thu Mar 08, 2018 4:14 pm

marcelinux wrote:
The C++ programming language
Chapter 6.
Expressions and Statements

Premature optimization
is the root of all evil.
– D. Knuth

On the other hand,
we cannot ignore efficiency.
– Jon Bentley
Sure, thanks.

User avatar
shawnhcorey
Knows some wx things
Knows some wx things
Posts: 34
Joined: Mon Nov 19, 2012 3:29 pm
Location: The Great White North

Re: wxString performance

Post by shawnhcorey » Thu Mar 08, 2018 4:59 pm

marcelinux wrote:
The C++ programming language
Chapter 6.
Expressions and Statements

Premature optimization
is the root of all evil.
– D. Knuth

On the other hand,
we cannot ignore efficiency.
– Jon Bentley
How is efficiency defined? Smallest memory? Least execution time? Least maintenance time?

User avatar
doublemax
Moderator
Moderator
Posts: 14044
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxString performance

Post by doublemax » Thu Mar 08, 2018 6:16 pm

I think we've drifted far enough from the original question. Time to let this thread rest.
Use the source, Luke!

Post Reply