Re: [PATCH v2 3/3] index-pack: eliminate unlimited recursion in get_delta_base()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2012/1/10 Junio C Hamano <gitster@xxxxxxxxx>:
> In parse_pack_objects(), we have two passes. The first pass scans to
> enumerate the objects that appear in the pack and sift them into base and
> delta objects, and the second one starts from a base object, resolves its
> immediate children with find_unresolved_daltas(), but that function recurses
> many times, bound only by the number of objects in the pack, which is the
> issue you are trying to address with this series.
>
> I wonder if a cleaner approach is to change the loop in the second pass in
> such a way that (1) the function it calls resolves _only_ the immediate
> children of the object we know its final shape (either because the object
> was recorded in the deflated form in the pack, or we have already resolved
> it in earlier iteration), and (2) the loop goes over the objects[] array
> not just once, but until we stopped making progress.

So basically:

 - remove the recursion code from get_base_data()
 - update find_unresolved_deltas() to mark resolved objects handled
 - put find_unresolve_deltas() call into a loop to go through all
unhandled objects

correct? Yeah I think it's simpler than current code.

> It would require us to be able to tell, by looking at objects[i], if the
> object itself has already been handled (perhaps you can look at its
> idx.sha1 field for this purpose) and if we have already handled its
> immediate delta children (you may need to add a bit to struct object_entry
> for this).
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]