Five levels. Eleven times slower.
transcript
A thread weight works for forty levels. Then threads reach forty-five. The request times out.
Weight of forty makes three hundred thirty-one million calls. Weight of forty-five makes three point seven billion. Five more levels cost eleven times the calls.
At forty-one, there are five hundred thirty-six million. At forty-three, one point four billion. At forty-five, three point seven billion. Each step multiplies by one point six.
Each level adds a step. Each step multiplies the calls by one point six. Five steps multiply by about eleven. The count grows by a factor, not by an amount.
Run a counter on small inputs. Find the rule behind the numbers. Then decide before you ship.
Weight of forty-five needs about ninety-five seconds. A request has a tenth of a second. The function is correct, and far too slow.
A counter on small inputs predicts the big ones. Full breakdown in the lecture.