[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnump3d-users] Test the pre-release?
From: |
Stuffed Crust |
Subject: |
Re: [Gnump3d-users] Test the pre-release? |
Date: |
Thu, 16 Nov 2006 12:26:06 -0500 |
User-agent: |
Mutt/1.4.2.1i |
On Sun, Sep 03, 2006 at 02:49:17PM +0100, Steve Kemp wrote:
> OK how does this look?
>
> http://www.steve.org.uk/Software/tmp/gnump3d-3.0/bin/gnump3d-indexer
>
> [tarball in http://www.steve.org.uk/Software/tmp/]
[[grr, silly editor lost my message...]]
A couple of comments on the indexer:
#
# Drop any entries and create the database.
#
purgeDatabase();
I wonder. Is it faster to drop and re-create the database each
time, or check for changes and update as needed? For example:
foreach file in list:
stat() file.
look up file in database.
if present
if file changed (mtime)
parse tags
update row.
else
parse tags
insert new row
The old tag cache was a simple in-memory lookup, but the new one could
potentially involve a call to the database for each file. (we could read
the whole thing into memory to speed things up....). I don't know what
kind of overhead that'll involve.
#
# The ID of the previous insertion.
#
# If we used MySQL we could use: $CONFIG{'dbh'}->{mysql_insertid};
#
my $id = 0;
$sth = $CONFIG{'dbh'}->prepare( "SELECT id FROM files WHERE fname=?" );
$sth->execute( $file );
my @data = $sth->fetchrow_array();
$sth->finish();
$id = $data[0];
There's a generic '$dbh->last_insert_id()' call in modern DBI versions
that would work here; if it returns 'undef' we can use the above code as
a fallback.
Another thing to consider -- SQLite can't handle multiple simultaneous
writers. If a request happens that doesn't have a tag cached, we
currently look up the tag and add it to the cache. We could conceivably
have two or more requests do this simultaneously. I don't know how well
the DBD::SQLite backend will handle the necessary locking.
- Solomon
--
Solomon Peachy pizza at shaftnet dot org
Melbourne, FL ^^ (mail/jabber/gtalk) ^^
Quidquid latine dictum sit, altum viditur. ICQ: 1318344
pgpovektL6rnv.pgp
Description: PGP signature