Thanks, FYI, while it was a bad code styling on my behalf (I just did it for showing en example) this was not my problem . creating 20000 short strings does not takes 20 seconds :) also note, that when avoiding sqlite3_reset and creating new sqlite3_stmt every time (and still creating those redundant string), there is no performance overhead.
the real problem is the fact that each time, a new transaction was created (see Richard's reply). by doing BEGIN and clutter all operations under one transaction, the program fly, On Wed, Nov 2, 2011 at 2:11 PM, Stephan Beal <sgb...@googlemail.com> wrote: > On Wed, Nov 2, 2011 at 12:59 PM, Igor Tandetnik <itandet...@mvps.org> > wrote: > > > The behavior of this fragment is in fact well defined by the C++ > standard. > > The temporary is destroyed at the end of the full expression - basically, > > at the semicolon, after the function call > > > > That was also my understanding until recently when a friend of mine asked > me to debug some code of his which mysteriously crashed. It was caused by a > Qt debug wrapper macro which did the equivalent of c_str() on a temporary > string instance. i unfortunately don't have the docs handy, and to be > honest i'm not 100% convinced that what i wrote about undefined behaviour > is true in that case, but i am 100% convinced that i've seen that usage > cause problems before. Perhaps it was the compiler in question (one of the > MSVC variants) which made the behaviour undefined, as opposed to be a > violation of the standard. > > In any case (undefined or not), calling ostringstream::str() twice there is > unnecessary, and downright inefficient if the user's STL does not use CoW > (all of them do, AFAIK, but that's an implementation detail clients > shouldn't count on). > > -- > ----- stephan beal > http://wanderinghorse.net/home/stephan/ > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users