Closed Sainan closed 2 years ago
Oh, and signed numbers:
int8_t std::to_string - 9.0304 ms soup::string::decimal - 15.1188 ms int16_t std::to_string - 11.2898 ms soup::string::decimal - 23.8747 ms int32_t std::to_string - 15.8378 ms soup::string::decimal - 41.2118 ms int64_t std::to_string - 70.7165 ms soup::string::decimal - 128.638 ms
with this beautiful line of code:
vec.emplace_back(soup::rand.t<T>(std::numeric_limits<T>::min(), std::numeric_limits<T>::max()));
om
om: 45.0839 u64_dyn: 39.2212 u64_dyn_v2: 40.538
u64_dyn_v2 was an attempt to store the control bit in the LSB, it seems to perform about the same as the original algorithm; who beat who seemed to be random, and overall not worth the cost of migrating.
I found that for I/O tasks using a std::vector<char>
instead of a std::string
is faster. A lot when writing, and even a little when reading. However, vector.insert(vector.end(), ...);
is slower than string.append(...);
string::decimal vs std::to_string for various T
Not a very surprising result:
Code used: