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

luke saunders luke at shadowcatsystems.co.uk
Fri Apr 25 18:05:32 BST 2008


On Fri, Apr 25, 2008 at 5:00 AM, Jason Kohles <email at jasonkohles.com> wrote:
>
> On Apr 24, 2008, at 6:54 AM, luke saunders wrote:
>
>
> > On Wed, Apr 23, 2008 at 8:42 PM, Matt S Trout <dbix-class at trout.me.uk>
> wrote:
> >
> > > On Wed, Apr 23, 2008 at 04:37:54PM +0100, Drew Taylor wrote:
> > >
> > > >
> > > > > What if you used link() instead of a copy?
> > > > >
> > > > > Or just make the dump code make the tmp dir, and populate open a
> file handle
> > > > > to everything in advance so you don't have to worry about paths
> changing
> > > > > under you?
> > > > >
> > > >
> > > > As I understand your suggestion, dumping to the tmp dir wouldn't work
> > > > for me because I make a dump only every so often, but populate from it
> > > > many times per day as I run my tests. I just want to zip through the
> > > > existing files w/o any IO other than reading/slurping the .fix files.
> > > >
> > >
> > > If dumping uses a temp dir, and populate just opens the filehandles,
> > > that's exactly what you'd get.
> > >
> > >
> >
> > Seems like a reasonable idea. My understanding here is that if a
> > filehandle is opened and that file is then removed, the filehandle can
> > still be read from. However I'm not clear on how that works,
> > presumably Perl doesn't read the file into memory when you first open
> > the handle, so what happens?
> >
> >
>  What happens (on reasonable OSes anyway) is that the original file still
> exists, even if there are no references to it in the directory structure.
> In perl terms, you can think of both the directory entry and the filehandle
> as references, pointing to the same underlying data.  The file doesn't
> actually go away until it's refcount drops to 0, which means that all the
> references to it in the directory structure are gone, and any filehandles
> that reference it are closed.  If you delete the original directory entry
> that pointed to it, and create a new file in it's place, that reference
> doesn't point at the original data, it's a new reference pointing to a new
> chunk of data on the disk.
>
>
>
> > Also I don't think link() works on all platforms.
> >
> >
>  This isn't entirely portable either, but I don't have any recent enough
> windows experience to say if it will explode on versions of windows released
> in this century or not...

Okay, thanks. Given this we should leave it for this release but
implement it or some other solution for the next release.

Drew, I have applied the insert_bulk part of your patch and will
release 1.001000 (http://xrl.us/bjtjq) over the weekend unless people
shout.

Cheers,
Luke.



More information about the DBIx-Class mailing list