[Xapian-discuss] Clearing Database For Tests

Ryan Bates ryan at railscasts.com
Tue Nov 3 17:21:44 GMT 2009


Thanks Olly,

I'm also getting 0.05 seconds with simpleindex after installing Xapian
1.0.16; before, when I was using 1.0.15, simpleindex was around 0.35
seconds.

However, even with Xapian 1.0.16 I'm not seeing much improvement when
interacting through the Ruby bindings. It's at least 0.35 seconds
still to generate the database.

rm -rf tmp.db
time ruby -e "require 'xapian'; Xapian::WritableDatabase.new('tmp.db',
Xapian::DB_CREATE)"
# 0.408 total

Unfortunately I'm not familiar with C profiling, and rub-prof isn't
very helpful helpful:

$ ruby-prof --mode=wall createdb.rb # using the same ruby code as above
Thread ID: 2148237740
Total: 0.499056
 %self     total     self     wait    child    calls  name
 98.93      0.49     0.49     0.00     0.00        1
Xapian::WritableDatabase#initialize
  0.71      0.00     0.00     0.00     0.00        1
Kernel#gem_original_require-1
  0.16      0.00     0.00     0.00     0.00        1
Kernel#gem_original_require
  0.07      0.50     0.00     0.00     0.50        1  Global#[No method]
  0.05      0.50     0.00     0.00     0.50        1  Kernel#load
  0.03      0.00     0.00     0.00     0.00        5  Module#attr_accessor
  0.02      0.00     0.00     0.00     0.00      367  Module#method_added
  0.01      0.00     0.00     0.00     0.00       86  Class#inherited
  0.00      0.49     0.00     0.00     0.49        1  Class#new
  0.00      0.00     0.00     0.00     0.00        1
<Class::Xapian::WritableDatabase>#allocate
  0.00      0.00     0.00     0.00     0.00        1  Module#module_function
  0.00      0.00     0.00     0.00     0.00       21
Kernel#singleton_method_added
  0.00      0.00     0.00     0.00     0.00        1  Kernel#require
  0.00      0.00     0.00     0.00     0.00        1  Kernel#require-1

Here it says it's taking nearly half a second to initialize a writable database.

Regards,

Ryan

On Mon, Nov 2, 2009 at 5:13 PM, Olly Betts <olly at survex.com> wrote:
> On Mon, Nov 02, 2009 at 03:36:01PM -0800, Ryan Bates wrote:
>> I am currently deleting the database directory and
>> regenerating it every time, but I find this to be very slow (nearly
>> half a second). This results in even a small number of tests taking a
>> long time to run.
>
> I just tried this, and it's more like 0.05 seconds elapsed time on average for
> me (including the overhead of running simpleindex).  I tested with:
>
> rm -rf tmp.db
> time examples/simpleindex tmp.db < /dev/null
>
> I tested with trunk on Ubuntu karmic with ext3 as the FS.
>
> Half a second seems unreasonably slow, but you're going to have to profile it
> to show us why it is so much slower for you.
>
> Cheers,
>    Olly
>



More information about the Xapian-discuss mailing list