This is an archive of the discontinued Mercurial Phabricator instance.

manifest: convert a recursive function to iterative one using stacks
ClosedPublic

Authored by pulkit on Dec 12 2018, 8:28 AM.

Details

Summary

I am debugging a memory issue from yesterday where hg update goes upto taking
22GB of memory on our internal treemanifest repository. This is an interesting
function and I saw memory consumption increasing while this function was
running.

It's sometimes hard to understand a recursive function and also the profile
won't show you actual operations which took time, rather it will show you the
function again and again in profile.

I am yet to notice any memory consumption decrease with this patch, but I
believe this will help like in making this a generator.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

pulkit created this revision.Dec 12 2018, 8:28 AM
pulkit edited the summary of this revision. (Show Details)Dec 12 2018, 8:34 AM
durin42 added a subscriber: durin42.Jan 9 2019, 3:05 PM
durin42 added inline comments.
mercurial/manifest.py
1139

room for a follow-up: I'm not sure this needs to be a nested function anymore (it could be a separate method on self)

This revision was automatically updated to reflect the committed changes.