Makes computeDepth take linear time
Makes computeDepth take linear time

computeDepth takes quadratic time because it needs to find the maximum depth of
each node and this can require repeated traversal as longer paths are found. In
order to compute this in linear time, we instead compute the height of each node
and then subtract this from the height of the root node. Heights can be computed
in linear time by a straightforward recursive algorithm with memoization.

Using a test example with a 400-task dependency chain with each task in the
chain depending on a task with 10000 dependencies the time necessary for
computeDepth on my laptop was reduced from about 5 seconds to about 13ms. This
is in line with the expected 400x speedup from removing quadratic behavior.

PeteW/luigi,PeteW/luigi,lungetech/luigi,bmaggard/luigi,wakamori/luigi,meyerson/luigi,thejens/luigi,stephenpascoe/luigi,lungetech/luigi,adaitche/luigi,samuell/luigi,Magnetic/luigi,humanlongevity/luigi,ivannotes/luigi,PeteW/luigi,humanlongevity/luigi,riga/luigi,stroykova/luigi,meyerson/luigi,riga/luigi,dlstadther/luigi,ehdr/luigi,meyerson/luigi,linsomniac/luigi,foursquare/luigi,spotify/luigi,foursquare/luigi,ehdr/luigi,sahitya-pavurala/luigi,thejens/luigi,dstandish/luigi,jamesmcm/luigi,ContextLogic/luigi,jw0201/luigi,Wattpad/luigi,rayrrr/luigi,edx/luigi,stroykova/luigi,mfcabrera/luigi,spotify/luigi,dlstadther/luigi,rayrrr/luigi,riga/luigi,bmaggard/luigi,ehdr/luigi,republic-analytics/luigi,ivannotes/luigi,wakamori/luigi,wakamori/luigi,Wattpad/luigi,mbruggmann/luigi,thejens/luigi,mbruggmann/luigi,spotify/luigi,edx/luigi,soxofaan/luigi,samuell/luigi,lungetech/luigi,mbruggmann/luigi,casey-green/luigi,jw0201/luigi,adaitche/luigi,spotify/luigi,fabriziodemaria/luigi,Magnetic/luigi,ivannotes/luigi,h3biomed/luigi,sahitya-pavurala/luigi,dlstadther/luigi,lungetech/luigi,samuell/luigi,jamesmcm/luigi,foursquare/luigi,rizzatti/luigi,samuell/luigi,jamesmcm/luigi,republic-analytics/luigi,jw0201/luigi,wakamori/luigi,oldpa/luigi,soxofaan/luigi,ContextLogic/luigi,bmaggard/luigi,dlstadther/luigi,jamesmcm/luigi,oldpa/luigi,samepage-labs/luigi,samepage-labs/luigi,linsomniac/luigi,Tarrasch/luigi,oldpa/luigi,stroykova/luigi,dstandish/luigi,soxofaan/luigi,adaitche/luigi,stephenpascoe/luigi,edx/luigi,meyerson/luigi,stephenpascoe/luigi,linsomniac/luigi,ivannotes/luigi,rizzatti/luigi,riga/luigi,Houzz/luigi,dstandish/luigi,rayrrr/luigi,sahitya-pavurala/luigi,adaitche/luigi,mfcabrera/luigi,soxofaan/luigi,casey-green/luigi,samepage-labs/luigi,republic-analytics/luigi,h3biomed/luigi,oldpa/luigi,thejens/luigi,sahitya-pavurala/luigi,ContextLogic/luigi,linsomniac/luigi,h3biomed/luigi,h3biomed/luigi,dstandish/luigi,Magnetic/luigi,foursquare/luigi,humanlongevity/luigi,ContextLogic/luigi,Houzz/luigi,fabriziodemaria/luigi,jw0201/luigi,ehdr/luigi,PeteW/luigi,fabriziodemaria/luigi,stephenpascoe/luigi,rizzatti/luigi,javrasya/luigi,javrasya/luigi,Tarrasch/luigi,republic-analytics/luigi,Tarrasch/luigi,mfcabrera/luigi,mbruggmann/luigi,Tarrasch/luigi,javrasya/luigi,fabriziodemaria/luigi,Magnetic/luigi,javrasya/luigi,Houzz/luigi,Wattpad/luigi,bmaggard/luigi,humanlongevity/luigi,rayrrr/luigi,casey-green/luigi,casey-green/luigi,Houzz/luigi,edx/luigi,samepage-labs/luigi,mfcabrera/luigi,rizzatti/luigi,stroykova/luigi