Re:I had to give a wrong answer to get the job (2017)
by munificent on Monday July 19, 2021 @02:54PM
(#27886077)
I feel like I've replied to this same thing about five times now, but, yes, I completely understand the latency concern with growing a dynamic array. At the time, we weren't talking about it. Their question was, "What is the complexity of this?" And I said, "It's constant time over a series of appends." We didn't get past that.
Re:I had to give a wrong answer to get the job (2017)
by asr21 on Monday July 19, 2021 @03:13PM
(#27886241)
The guy worked at EA for 8 years.. He must know what he is talking about
Re:I had to give a wrong answer to get the job (2017)
by sudopluto on Monday July 19, 2021 @04:19PM
(#27886847)
he also wrote the crafting interpreter book : )
Re:I had to give a wrong answer to get the job (2017)
by munificent on Monday July 19, 2021 @06:09PM
(#27887853)
And Game Programming Patterns, which has a chapter on the performance effects of contiguous data:
https://gameprogrammingpatterns.com/data-locality.html
:)
For games, it absolutely does matter that only some appends trigger latency, because that causes stuttering in the game play. A linked list may be slower in most use cases...but the performance cost is fixed and can be easily designed around.