x wrote: > const int Size[]={112000000,1000000000}; // 112 million, 1 billion > > v.resize(Size[i]); > > // NB the exact same code is executed whether i is 0 or 1. > The only thing that > // changes is the size() of v and v isn't even used in the > timed code below. > > clock_t Start=clock(); > > while (sqlite3_step(stmt)==SQLITE_ROW) {} > > // Above just steps through stmt (111,724,900 steps to be > exact). > > std::cout << 1.0*(clock()-Start)/CLOCKS_PER_SEC << std::endl; > i==0 i==1 > 19.938 25.516 > > I can't understand why the second pass (exact same code executed) takes an > average of 4.8 secs longer.
I'd guess that allocating the vector throws out cached data from the OS file cache, so it has to be read again from disk. To measure this, add a pause between the loop iterations, and use some tool (e.g., Resource Monitor) to check actual disk accesses. Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users