At 4:22 PM -0700 11/3/05, Robert Simpson wrote:
It's 100,000 more memory allocations and about 4.6mb of string copies SQLite is doing behind the scenes. Every time SQLite prepares a statement it allocates and copies the string. If you're inserting a million rows into a database using the above "cheese" method (which I hate but a lot of folks do anyway) then that's a pretty serious performance hit IMO.
This only happens if you are not reusing prepared statements for each row going into the same table. And if you're not reusing prepared statements, you're already doing 100,000 memory allocations that you shouldn't be doing, for the statement handle itself, and have already hit yourself. Use prepared statements and both hits are brought down to something negligible. -- Darren Duncan