« first day (3069 days earlier)   

05:27
If you have a problem and use reg ex to solve it now you have two problems :-(
 
10 hours later…
15:06
@JerryCoffin Thanks, this looks better to copy paste within my code
This is more of a general question, so I can understand if this goes unanswered. I primarily code in Python, where if "simple" tasks span multiple lines, chances are it is going to be slow and its safe to assume it will be slow. Is that mindset OK in C++? Or should one always profile when writing C++?
nwp
nwp
C++ only loosely correlates with code size. If you write instructions it kinda works, but things like class definition and template lines translate very poorly to a number of instructions.
The general wisdom is to at first not care about performance. It's fast enough. This works until it doesn't and when it doesn't you go the full profiling plus benchmarking route.
There are some things in between. Copying large containers unnecessarily can easily produce performance issues, but also easily be avoided without the need for profiling or benchmarking.
15:54
Even when you do look solely at instructions, it only kinda works, even at best. Just for example, a = b; might be really fast (e.g., you're assigning an int) or extremely slow (you're copying a couple gigabyte vector). In the latter case, a = std::move(b); will (at least normally) be millions of times faster than just a=b;.

« first day (3069 days earlier)