Hello,
This letter has three distinct questions, with Q1 being the main.
Q1:
This new amalgamation feature is really great. A simple test program
inserting 24 millions rows, each row is an integer PK and three
integers of data, runs 40% faster for me.
But how to properly compile the amalgamation wrt C preprocessor
defines? Suppose I got sources tarball, and did './configure
--some-options CFLAGS=...'. This produces a Makefile, I can do 'make
sqlite3.c', but I also would like to be able to do 'make sqlite3.o',
so that compilation would actually use all the proper C preprocessor
defines and options resulted from 'configure' run. Currently, I have
to look though generated Makefile to see what options/defines I should
use to get the same result. It there a better way?
Also, when linking with sqlite3.o options '-pthread -ldl' to gcc are
required. It would also be nice if, for instance, 'make
amalgamation-link-options' would print the required options.
Q2:
Why pread()/pwrite() aren't used by default? Yes, we don't _have_ to
use them when the connection object is not shared across threads, but
lseek() before every read()/write() is a bit of overkill.
'-D_FILE_OFFSET_BITS=64 -DUSE_PREAD64=1' did the trick for me with gcc
3.4.2 and glibc 2.3.3 (surprisingly, other combinations didn't work,
and I didn't look into that further), but I'm worried a bit that
USE_PREAD/USE_PREAD64 defines don't look like a part of the user
interface (don't begin with 'SQLITE_').
Q3 (not really core SQLite-specific, but maybe someone have the answer
right away):
I wrote a C application that prepares a statement, and then, in a
loop, inserts 24M rows as described above, binding new values on each
iteration. When I link it with libsqlite3.so.0.8.6, it runs a certain
amount of time, say, 206 seconds. When I rewrite it in Perl using
DBI+DBD::SQLite (and I'm certain that DBD::SQlite uses the same shared
library), it, of course runs longer, the whole 885 seconds. But
OProfile shows:
1416755 100.000 perl
GLOBAL_POWER_E...|
samples| %|
------------------
577749 40.7797 libperl.so
494994 34.9386 libsqlite3.so.0.8.6
110445 7.7956 libc-2.3.3.so
82901 5.8515 SQLite.so
81748 5.7701 DBI.so
48687 3.4365 libpthread-2.3.3.so
...
Now, 885 * 34.9% = 308 seconds, which is much bigger that 206 seconds
for C program. The main loop in Perl program is simply
for (my $i = 0; $i < 24_000_000; ++$i) {
$insert->execute($i, $i, $i);
}
where $insert is a handle of prepared statement, and the main loop of
C program is functionally the same, so I wonder, what may cause such a
big difference.
I could dig into this myself, but maybe someone has encountered the
same problem before?
Thanks!
--
Tomash Brechko
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------