The following is very slow for long strings:
std::string s = "long string";
K klist = DBVec::CreateList(KG , s.length());
for (int i=0; i<s.length(); i++)
{
kG(klist)[i]=s.c_str()[i];
}
It works acceptably fast (<100ms) for strings up to 100k, but slows to a crawl (tens of minutes, possibly hours) for strings of a few million characters. I don't see anything other than kG
that can create nonlinearity. I don't see any reason for accessor function kG
to be non-constant time, but there is just nothing else in this loop. Unfortunately I don't know how kG
works due to lack of documentation.
Question: given a blob of binary data as std::string, what's the efficient way to construct a byte list?
This works:
Still wonder why that loop is not O(N).