[MERGE] use a serial number and one random value for fileids

Robert Collins robertc at robertcollins.net
Fri May 19 05:39:08 BST 2006


On Fri, 2006-05-19 at 00:32 -0400, Aaron Bentley wrote:
> Robert Collins wrote:
> > On Thu, 2006-05-18 at 23:22 -0400, Aaron Bentley wrote:
> > 
> >>Robert Collins wrote:
> >>
> >>>This patch uses a serial number and a single random value for 'bzr add'
> >>>rather than brand new randomness each time.
> >>
> >>>The only hole I can see is someone doing fork() after calling add, and
> >>>then calling add in the child. We probably should add an atfork hook to
> >>>reset the seed in this case.
> >>
> >>Did you consider just doing it in Tree.add?  That seems even safer and 
> >>more transparent to me.
> > 
> > 
> > I assume by 'it' you mean caching the random prefix.
> 
> No, I mean generating a new prefix and starting the counter back at 0 
> for each invocation of add.  This would mean that for bulk adds, you'd 
> specify all the files to be added at once.
> 
> So does this give us a speed boost?

If we restructure smart_add we can probably do it in this way. However
this is much less of an incremental change. I think adding a TODO to do
this is a good idea though. How does that sound?

Speed wise, the three changes - the is_control call reduction, the
is_ignored tuning and the randomisation tuning have shaved 10 seconds
off the add of 10K files.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060519/5e2ca143/attachment.pgp 


More information about the bazaar mailing list