On Tue, Jan 14, 2014 at 7:46 PM, Kenneth Adam Miller < kennethadammiller@gmail.com> wrote:
On Tue, Jan 14, 2014 at 1:58 PM, Kenneth Adam Miller < kennethadammiller@gmail.com> wrote:
Thank you.
On Tue, Jan 14, 2014 at 1:55 PM, Krzysztof Czainski <1czajnik@gmail.com>wrote:
2014/1/14 Kenneth Adam Miller
Ah ok. I apologize for posting too fast. I will be sure to go further in exhausting all resources before I post in the future. However, I did find some of the descriptions of the iostreams parts and how they compose (especially examples, that's what I was really looking for) vague, IMHO.
No, I haven't measured performance.
[...]
Those unnecessary allocation copies would, in the worst case, result in a 2-3x slowdown of the entire program
How do you know?
due to the fact that it's literally pausing to repeat something that's unnecessary.
But actually, if this appends my 30k string, I didn't know it. The back_insert_device<string> object wasn't something that I understood very well from the description at http://www.boost.org/doc/libs/1_45_0/libs/iostreams/doc/classes/back_inserte...
From what I had thought though, if my string was empty with 0's,
Right here's your mistake. string(30000,0) creates a non empty string. It's a string of 30k nulls.
and I appended to it, then I would end up with precisely my compressed data. The idea of acquireStringFromPool is that it returns a large string that is always cleared out for the filtering_ostream to fill up as though it were a device. Is that incorrect? How can I get that functionality?
Like I said, you want std::vector::reserve().
Ok, so supposing I just use a vector; do I use vector<byte>? Is it more efficient to use vector< word_size_of_computer > since any write to it would obviously be faster or will the compiler catch this? Also, when I grab all of the bytes from vector, does it automatically detect when the end is? Like, one of the purposes of having 0's all through the string was so that it was always terminated. In the case of vector, if I push_back 3 times, and then I output, will I get 3 bytes?
Also, supposing I go with something like vector
Perhaps, however, that reserve approach would be good. I apologize the
email was so long lol.
Btw, you're still top-posting. The idea is to leave the (minimal) context above your reply message ;-)
By top posting you meant just the position of my text. I thought you meant it to be me posting when I could have more fully investigated the issue. I will follow this convention.
Regards, Kris
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users