On Monday, 27 November 2017 at 06:12:53 UTC, Ola Fosheim Grostad
wrote:
On Monday, 27 November 2017 at 05:11:06 UTC, Neia Neutuladh
std::string does the same thing. So if I reimplemented subtex
naively in C++, its performance would be closer to the C#
version than to the D version.
You meant stupidly, you would rather use std::string_view for
string references in C++.
I last used C++ professionally in 2015, and we were still rolling
out C++11. std::string_view is part of C++17. You're calling me
stupid for not having already known about it. (Yes, yes, you were
sufficiently indirect to have a fig leaf of deniability.)
std::string is a library convenience type that typically is
only used for debugging and filenames. If you want performance
then it really isnt possible to make do with a fixed library
type for strings so in a realistic program people would write
their own.
An efficient text parser doesn't seem like a sufficiently unusual
task that it should require you to create your own string type. A
large swath of programs will use at least one text parser.
Sure. But maybe you shouldn't use a tiny 400k input when
discussing performance. Try to think about how many
instructions a CPU executes in 50ms...
It is often useful to talk about real-world workloads when
discussing performance. The reference document I'm talking about
is a short novel of 75,000 words. It was a document I already had
on hand, and it was within a factor of two of the largest I
expected to feed through subtex.
And I already had the numbers on hand:
<https://blog.ikeran.org/?p=277>
If you want me to do more in-depth testing, you'll have to pay me.