[Dbix-class] DBIx::Class::Fixtures speedup

luke saunders luke at shadowcatsystems.co.uk
Wed Apr 23 12:43:14 BST 2008


On Wed, Apr 23, 2008 at 12:14 PM, Drew Taylor <taylor.andrew.j at gmail.com> wrote:
> I'm using Fixtures in my app, and am overall pleased with it. But I
>  now have a couple thousand fixture items which are imported, and
>  that's taking upwards of 1min+. Out of curiosity I commented out the
>  creation of the tmp_fixtures_dir and just read from fixtures_dir. I
>  shaved my populate() time in approximately half. What's the reasoning
>  for the tmp dir? Safety in case anything goes wrong? For me, it's just
>  a lot of wasted IOs and time. :-) Luke, any objections if I remove
>  this?
>

The tmp directory is used so that if someone dumps while you are
populating the populate is unaffected. Since this is an issue for some
people I'd suggest making the tmp directory thing configurable,
probably in the call to ->new. Normally if the fixtures are on a local
drive using a tmp directory doesn't take too long so I'd prefer to
keep it the default.

>  Also, I was able to shave off a few more seconds by switching to
>  gathering all the row data for a given source and then calling
>  $schema->populate(\@rows) so the insert_bulk functionality can be
>  used. castaway++
>

Good idea.

>  Here's the combined patch:
>

Thanks, if you make the tmp directory thing configurable and make the
tests pass I can apply.

Cheers,
Luke.



More information about the DBIx-Class mailing list