Doubling against ten
transcript
A buffer must grow when it is full. Double it, or add ten slots? Both resize only when full. So the rules look almost the same. Count the copies over a thousand pushes.
Doubling copied one thousand twenty three items. That is about one copy for each push. Resizes get rarer as the buffer grows. Each one copies more, but waits longer.
Adding ten slots copied forty nine thousand six hundred. That is forty nine point six copies for each push. The buffer resizes every ten pushes, however large it is. Each resize copies the whole buffer.
Now run a hundred thousand pushes. Adding ten costs almost five thousand copies for each push. Doubling still costs about one and a third. Fixed growth gets worse as n grows. Pick the rule that scales with the run.
Grow by a constant factor. Two or one and a half both work. A fixed amount grows like n squared.
Grow by a factor. Full breakdown in the lecture.