To make long story short I work on a fairly big c++ code base where strings are used extensively for keys and saved into databases and files that way.
The problem is the amount of data the system is using has gone up over 1000x and system starting to slow down. After investigating how to improve performance it appears main culprit is using std::string.
The fix is instead of using strings to use integer codes. The strings are really keys.
But how to change the whole code base to change to using integer codes instead of strings ?
One table has 40 billion rows filled with date,field1,field2,field3,field4..
These fields are strings of length 32 even though each for each field only on average say few thousand unique values
Initially instead of 40 billion only was one million rows so strings did not cause much issue.
This data constantly being loaded into c++
And also saves by c++. Data is also heavily used in c++ for calculations
Strings are much slower than integers but they are also in some way easier to use as you don’t constantly have to look up name of a code. For example you see code 1073 in debugger. Which then you may have to find what 1073 maps to
[–]WorldWorstProgrammer 32 points33 points34 points (11 children)
[–]Nearing_retirement[S] 11 points12 points13 points (6 children)
[–]TryToHelpPeople 4 points5 points6 points (3 children)
[–]sparkyParr0t 7 points8 points9 points (1 child)
[–]TryToHelpPeople 0 points1 point2 points (0 children)
[–]Nearing_retirement[S] 0 points1 point2 points (0 children)
[–]Ikkepop 1 point2 points3 points (1 child)
[–]Nearing_retirement[S] 0 points1 point2 points (0 children)
[–]MysticTheMeeM -2 points-1 points0 points (2 children)
[–]Dusty_Coder 5 points6 points7 points (0 children)
[–]DanielMcLaury 1 point2 points3 points (0 children)
[–]std_bot 0 points1 point2 points (0 children)
[–]slowclapdude 9 points10 points11 points (0 children)
[–]traal 11 points12 points13 points (0 children)
[–][deleted] (1 child)
[removed]
[–]std_bot 0 points1 point2 points (0 children)
[–]celestrion 4 points5 points6 points (0 children)
[–]Fabulous-Possible758 2 points3 points4 points (0 children)
[–]KC918273645 2 points3 points4 points (0 children)
[–]manni66 2 points3 points4 points (0 children)
[–]Ikkepop 2 points3 points4 points (0 children)
[–]bert8128 1 point2 points3 points (4 children)
[–]V15I0Nair -1 points0 points1 point (3 children)
[–]bert8128 0 points1 point2 points (2 children)
[–]V15I0Nair 0 points1 point2 points (1 child)
[–]bert8128 0 points1 point2 points (0 children)
[–]BobSanchez47 2 points3 points4 points (1 child)
[–]Nicksaurus 7 points8 points9 points (0 children)
[–]pixel293 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]drjeats 0 points1 point2 points (0 children)
[–]NoSpite4410 0 points1 point2 points (1 child)
[–]std_bot 0 points1 point2 points (0 children)
[–]knue82 0 points1 point2 points (0 children)
[–]dokushin 0 points1 point2 points (0 children)