Timeline for Optimizing redundant string allocations in C++
Current License: CC BY-SA 3.0
20 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 8, 2017 at 9:21 | vote | accept | Muton | ||
| Dec 7, 2017 at 15:20 | answer | added | user204677 | timeline score: 3 | |
| Jan 19, 2017 at 22:03 | history | edited | user22815 | CC BY-SA 3.0 | deleted 74 characters in body |
| Jan 19, 2017 at 21:57 | answer | added | gnasher729 | timeline score: 0 | |
| Jan 19, 2017 at 21:26 | answer | added | Basile Starynkevitch | timeline score: 2 | |
| Jan 19, 2017 at 14:05 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Dec 20, 2016 at 13:07 | answer | added | asger | timeline score: 0 | |
| Dec 11, 2016 at 11:53 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
| Nov 14, 2016 at 6:54 | comment | added | rwong | <string_view> (C++17) | |
| Nov 14, 2016 at 6:14 | comment | added | Muton | I'm not doing that much string manipulations and mostly just allocating memory for individual string values read from a larger buffer. The values are created separately and just happen to contain the same values. In many ways my component is similar to a JSON or XML parser. | |
| Nov 12, 2016 at 9:20 | history | tweeted | twitter.com/StackSoftEng/status/797368386430832640 | ||
| Nov 11, 2016 at 19:39 | comment | added | Jerry Coffin | Are all (or even most) of the redundant strings created by copying/assigning strings inside the program, or are they created separately, and happen to contain the same values? | |
| Nov 11, 2016 at 18:27 | comment | added | Martin Ba | Try to google for flightweight/ flyweight pattern. | |
| Nov 11, 2016 at 11:11 | answer | added | user188153 | timeline score: 0 | |
| Nov 11, 2016 at 10:05 | comment | added | amon | What are you doing with those strings? Are they just used as some kind of identifier or key? Or are they combined to create some output? If so, how do you do string concatenations? With + operator or with string streams? Where do the strings come from? Literals in your code or external input? | |
| Nov 11, 2016 at 9:29 | comment | added | rwong | Have you analyzed what types of string manipulations dominate your application? Is it copying, sub-string extraction, concatenation, character-by-character manipulation? Each type of operation requires different optimization techniques. Also, please check if your compiler and standard library implementation supports "small string optimization". Finally, if you use string interning, the performance of the hash function is also important. | |
| Nov 11, 2016 at 9:21 | comment | added | rwong | This question is more relevant: stackoverflow.com/q/26130941 | |
| Nov 11, 2016 at 9:02 | comment | added | Hulk | somewhat related question from SO: stackoverflow.com/q/10634918/2513200 | |
| Nov 11, 2016 at 8:47 | comment | added | Hulk | Feasible? Yes certainly - other languages do this routinely (e.g. Java - search for String interning). One important thing to consider, however, is that the cached objects need to be immutable, which std::string is not. | |
| Nov 11, 2016 at 7:56 | history | asked | Muton | CC BY-SA 3.0 |