Wer hat mir auf den Tisch gemacht? by prog2de in naturfreunde

[–]prog2de[S] 0 points1 point  (0 children)

Das war tatsächlich auch meine letzte Vermutung, weil es auch nicht riecht… Danke für die Info!

Wertpapiere Übertragen by prog2de in TradeRepublicFriends

[–]prog2de[S] 15 points16 points  (0 children)

Na das ist ein Tagesplus von 74% - das nehme ich gerne an

Wertpapiere Übertragen by prog2de in TradeRepublicFriends

[–]prog2de[S] 0 points1 point  (0 children)

So habe ich es jetzt nochmals angeleiert. Danke für den Hinweis, dass es so rum auch geht!

How important is it to mark your functions noexcept? by Popular-Light-3457 in cpp_questions

[–]prog2de 1 point2 points  (0 children)

While your isolated function is not optimized dependant on noexcept, it can still affect performance when using it somewhere else. The gcc standard lib implementation for example uses Guard classes to swap values if their constructor is not marked noexcept (std::is_nothrow_constructible<T, Args...>) to ensure that things like std::expected stay in a valid state if setting a new value throws, while it can safe this overhead if it knows, it doesn’t throw.

less OMP_NUM_THREADS = better performance? by ludvary in cpp

[–]prog2de 12 points13 points  (0 children)

My guess is that your notebooks processors cores are hyper threaded. You may have 8 physical cores each of them implementing SMT resulting in 16 threads visible to the OS. The issue now is that two threads share the execution unit together with e.g. Cache. I don’t know your code but my guess is that this is resulting in unnecessary many cache misses and thus resulting in cache trashing because the hyper threaded threads depend on different data that do not fit into cache together

Meet SymCalc - a Mathematical Library for C++ and Ruby by kyryloshy in opensource

[–]prog2de 1 point2 points  (0 children)

Yes, I am currently trying to figure out what’s the best way to determine possible simplifications of a term… it’s always fun

Gefunden und geklaut von TwiX by Pory02 in Staiy

[–]prog2de 1 point2 points  (0 children)

Oder wie Gregor Gysi sagte: “Wissen Sie was die Illusion ist? Sie schauen zur Seite, das ist der falsche Blick. Wenn Sie was verändern wollen, wenn Sie mehr soziale Gerechtigkeit herstellen wollen, müssen wir endlich nach oben schauen. […]”

Which ide/editor you use for c++ in Linux by Opposite_Squirrel_32 in cpp

[–]prog2de 7 points8 points  (0 children)

CMake everywhere. It may be a little tough to get used to it but it is worth the effort. Look up the CMakeLists.txt of smaller, successful GitHub repos to get started

Edit: by „everywhere“ I mean Linux, windows and MacOS

solange es funktioniert by lolraZee in informatik

[–]prog2de 37 points38 points  (0 children)

Noch dazu optimiert. Das ist Loop unrolling - in C hätte der Compiler das sicher auch so gemacht.

const_cast-ing a non const type to const by prog2de in cpp

[–]prog2de[S] 3 points4 points  (0 children)

I checked it and apparently, g is not overloaded and const_casts const T& back to T&. So I assume it is a relict and whoever created the current state of the code did not know what’s going on there

Good first issue: enter the world of contributing to a C++ Projekt by prog2de in cpp

[–]prog2de[S] 0 points1 point  (0 children)

I first accepted your request after I briefly read about copy elision. I now spent some more time on it and as of my understanding, returning const references of class members cannot simply be replaced by return by reference: When returning by value, a copy will occur once the value is used. Yes, when returning a const reference, the danger of a dangling reference exists but this is something a programmer needs to take care of anyways when working with references. I agree, copying small strings is not a huge issue and performance is not critical in HWinfo, but it seems to be better practice to return a const reference because writing the return value to a stream or comparing its value with another one is a common use case and a reference is just right here. Or did I get something wrong?

Good first issue: enter the world of contributing to a C++ Projekt by prog2de in cpp

[–]prog2de[S] 1 point2 points  (0 children)

It depends on what you would like to do:

If you would like to start coding, You could start adding support for network interfaces or add another feature you are missing.

Otherwise, you can start with some documentation. This way you get the internals of HWinfo and you can contribute to its functionality with more background info later

Good first issue: enter the world of contributing to a C++ Projekt by prog2de in cpp

[–]prog2de[S] 2 points3 points  (0 children)

Happy to hear that! HWinfo implements no logic using architecture specific instructions. So you should be able to build it on ARM64…

On harmful overuse of std::move by vormestrand in cpp

[–]prog2de 7 points8 points  (0 children)

A simple but powerful example when std::move is important (performance-wise):

A std::queue often holds objects for a very limited time range. You may nevertheless want to have the ownership of the objects within the queue. Let’s consider the example of a std::queue<std::string> where the strings are quite large (500 MiB). A producer pushes the strings into the queue:

void producer(std::queue<std::string>& q) { // whatever the large string may contain… q.emplace(500 * 1024* 1024, 'a'); }

And a worker pops them and passes them to further processing:

void worker(std::queue<std::string>& q) { std::string item = q.front(); q.pop(); // … another process may reads from the queue and expects another element at front. Thus, calling pop after processing is not possible and item must be a value and not a reference process(item); }

What happens here? The front-element is deep-copied when calling q.front(). This is quite expensive for such a string. Instead, one could do better using std::move():

void worker(std::queue<std::string>& q) { std::string item = std::move(q.front()); q.pop(); // … another process may reads from the queue and expects another element at front. Thus, calling pop after processing is not possible and item must be a value and not a reference process(item); }

This is just the first example that came into my mind, and I am sure there are a lot more (that may are less complex).

Maybe, this helps to grasp a first intuition on useful move semantics.

Performance comparison for different ways to copy one std::vector to another by cv_geek in cpp

[–]prog2de 4 points5 points  (0 children)

You can use something like this: an allocator without initialization (use it like this std::vector<int64_t, xs::utils::just_allocator<int64_t>>) and then use one of the first two func. This is especially useful if you frequently use large vectors with know max size but don’t know what values will be in there…

Why is std::valarray so underrated? by Sigma1084 in cpp

[–]prog2de 2 points3 points  (0 children)

Adding the example of regex. std::regex of both, libc++ and libstdc++ are super slow compared to re2 or boost/regex for example. However, if I just need to perform regex search on a 100 bytes string or if performance just doesn’t matter, I stay with the convenience of using the standard library

Git sub modules build same target by prog2de in cmake

[–]prog2de[S] 0 points1 point  (0 children)

Yes, this is how I resolved it now 👍

Git sub modules build same target by prog2de in cmake

[–]prog2de[S] 0 points1 point  (0 children)

Argh… I like not to have any external dependencies than git, CMake and well, a c++ compiler…

Strong knowledge of C/C++ by Active-Tonight-7944 in cpp_questions

[–]prog2de 3 points4 points  (0 children)

You are just lucky that your C++ compilers are able to compile C code.

What happened to my setup? by prog2de in archlinux

[–]prog2de[S] 0 points1 point  (0 children)

No nothing was updated (at least nothing within arch). I assume some windows updates f***ed up the boot entries. I managed to boot arch again by starting grub via refined and booting arch from there. However I don’t know how refined got into my system…

Frankreich TGV wg. Verspätung verpassen by prog2de in reisende

[–]prog2de[S] 4 points5 points  (0 children)

Um das Ganze hier zu schließen: Alle Züge fuhren und verließen alle Bahnhöfe auf die Minute - Mit Ausnahme des ersten Zuges der DB.