Oliver Schönrock
  • Member for 2 years, 2 months
  • Last seen this week
Dijkstra path finding in C# is 15x slower than C++ version
8 votes

More speed for both C++ and C# Revisiting an older question. While reading this question and its already very good answers the following occurred to me: Hash tables are slow Both the hashing and the ...

View answer
Ohms law calculator + whitelist of user. Learning use
8 votes

Don't using namespace std; This doesn't do what you want (only first one works): //Whitelist Whitelist = "Fred267s", "Seb4572s", "Popp4593s"; //Check if username is on whitelist ...

View answer
C++ Rate Controller
Accepted answer
7 votes

As per my comments under your question, I would suggest that you use some C++ abstractions to do the "heavy" lifting for you. eg don't do your own memory allocation with new nor your own ...

View answer
Exercise 1_2 multiple console outputs. I would like to reduce the number of console output statements
Accepted answer
7 votes

Scope This is really just limited to style and code formatting. Two (almost) substantive points You should get in the habbit of not: using namespace std; It can get you into name-clash issues ...

View answer
Find and replace a string in C/C++ without using standard library
Accepted answer
6 votes

Aim It's not 100% clear in your question, but what I am assuming is that you would like some feedback on: How to utilize C++ for this problem domain without using the STL (ie namespace std::) How to ...

View answer
Mathematical Camera class with types of Eigen library
Accepted answer
5 votes

Scope I cannot fully comment on use of the class or the linear algebra involved, because: It's not clear how it will be used There are no real operations shown, just setup/config of the class plus ...

View answer
Dutch National flag solution in C++
Accepted answer
5 votes

That's pretty good! Some small points... Motivation As, some of the comments point out, standard algorithms exist for std::sort and std::partition. You seem to be doing this in order to learn about ...

View answer
Multi Threaded High Performance txt file parsing
4 votes

C++ port of Björn's code using a single large array instead of one hashmap per thread. Björn's C code is very nice, but this question was tagged C++ so i thought it was worth showing that too. The ...

View answer
SequencedMap which retains insertion order - Design#2
4 votes

OK, in the interest of not inventing wheels, I tried boost::multi_index. Took half an hour to get over their approach, type syntax and their API. But it's actually really good. Very flexible, very ...

View answer
abstract base classes versus the curiously recurring template pattern
Accepted answer
3 votes

CRTP Caveat: It's not quite clear what the <a> template parameter is doing/ For my understanding your option1 defeats the purpose of CRTP. That is, if it's even trying to do CRTP. It's not ...

View answer
Get word frequency of a txt file and save it to linked list
Accepted answer
3 votes

String parsing You are right that C++ slightly lacks some convenient features for string parsing. If you were not trying to count lines as well as find words, then a single while loop with: inFile ...

View answer
Finding all alphanumerical words in a text line using std::string
3 votes

General Please ensure code compiles when posting it here. Or state a specific justification why it doesn't. (e.g. Print() was missing a <<) Putting it all together There are quite a few ...

View answer
High performance txt file parsing
3 votes

I am going to try to summarise and incorporate some findings from the very good and lively discussion in the comments above. I have put together a "best case". "Best" without going "totally silly", ie ...

View answer
c++ Checking if a string is an isogram
3 votes

Many good comments have been made already, eg: code in a function limit source code witdth to to 80-100 columns code is overly complex for the task, hard to digest it Try to use the available ...

View answer
Records and elements class, small "database" c++, no sql
Accepted answer
2 votes

Serialisation What you have is OK. It works, but your serialisation code is verbose, brittle, manual, and hard to maintain. This is a very common problem. Plenty of libraries out there, including ...

View answer
hexdump(): A memory layout utility to help debugging / understanding / optimising of C++ memory model
2 votes

A refactored improved version taking on board many of the points from @G.Sliepen's answer and then building on them: No more void* except for the general form ctor of hd Main function hex_dump() ...

View answer
Header only HTTP client library that is a wrapper around CURL
Accepted answer
2 votes

Quite a bit of code to look at. This is not a complete review, but I did two simple things, which may prompt thought / improvements: I ran a static analyser over your code (clang-tidy V9). The output ...

View answer
Pythagorean Triple finder
2 votes

An answer to document how to integrate some of the excellent feedback points from @G. Sliepen in his accepted answer above. The following have been changed from the original question above: Remove ...

View answer
Sorting multiple vectors based on a reference vector
1 votes

Firstly, refer my comment under your question: "Is there a good reason for parallel vectors at all? Or should it be a single vector of struct {int, int, ...}?" Assuming there is a good reason: ...

View answer
More ergonomic / convenient STL algorithm calls -- sort order & member field extraction using std::invoke
1 votes

Some benchmarking data as promised: Cut to the chase, results: -------------------------------------------------------- Benchmark Time CPU Iterations ----------------------...

View answer
c++ Checking if a string is an isogram
1 votes

As an alternative to the "efficiency" focused options in my other answer, here is an option which is just very terse. Given we can't have words > 26 characters which are isograms, this might be just ...

View answer
MySQL/MariaDB Data extraction / String manipulation / "TopN" processing => Performance of C++ vs php vs python
1 votes

Another "comparative self answer" of sorts EDIT: Against my better judgement I tried buffered=True on the python connection. And it's faster: 790ms => only 2x slower than php Just for laughs I tried ...

View answer
A simple 3D Wrapper class around std::vector
1 votes

Quick comments: unsigned long => size_t everywhere ... it's the same, but that's the alias for this job check for _xDim, _yDim, _xDim < 0 ... underflow is also undefined behvaiour ;-) implement ...

View answer
SequencedMap which retains insertion order - Design#2
1 votes

Integrating all the pieces. Quite nice now? Faster insert than my version at top (less branches I think!). See below for state and history: #include <algorithm> #include <iostream> #...

View answer
Moving elements satisfying a predicate from one container to another
1 votes

I did quite a lot of testing and trialling with this. For almost any size of container (both in elements and bytes), despite what one might think, a vector is much faster than a linked list for this ...

View answer
Estimate 𝜋 using Machin's formula
0 votes

Updated code, incorporating @G. Sliepen's feedback. Also adding a second arctan() which uses Euler's series - old one renamed to arctan_taylor() The new series converges faster and does not require ...

View answer
MySQL/MariaDB Data extraction / String manipulation / "TopN" processing => Performance of C++ vs php vs python
Accepted answer
0 votes

Providing a possible answer to my own question. Leaving original in tact for the record. In order to address the performance issues with mariadb++ I wrote a very slimline, and zero cost, c++ ...

View answer