We are talking about Ren'py, so about Python, and I explicitly talked about "most modern languages". Plus, by itself what I said explicitly limited the subject to dynamic arrays.
You realize there is only 5 years difference in age between C++ and python and 10 years between C++ and java.
That said pascal is 50yo and C is 48yo. But C++'s vector which is a dynamic array of sorts is created using C and then later recompiled using C++ because once the libraries were created the first time it was possible to rebuild the libraries using C++.
So in that effect even C++ has a dynamic array because All of Pythons, Java's and pretty much every modern languages compiler comes back to code that was created with C and C++.
There aren't many modern languages that where created without using C or C++. Sure someone could create a modern language with ASM take it from someone that has done that it's not much fun.
Why mention all that well. The point is the root of all these languages comes back to effectively two C and ASM. There is only a few ways in which a dynamic array can be created.
The first is one in which you reallocate and create a copy. It will get slower over time because the more you copy the longer it takes.
The second is a variant of the list method. It won't get slower over time when used for a stack because the pointer always sits at the end also won't run out of space and has a constant time. It will get slower if someone needs to traverse that list.
The third is pre-allocation in which you don't tell the user memory has been allocated for a lot larger space and you keep track of what is used with an end point variable. The draw back is that it uses a set amount of space that can still be expanded using the first method.
To be clear I haven't seen 2 used in a very long time. I think the last time I see someone do that was in college when creating a dynamic array was the assignment the prof gave out.
All of them will however cause a slow down when it comes to something like Renpy's Roll Back feature copying it because that requires traversing the entire array regardless the type. The first and third will be relatively fast the second will be really slow in comparison.
So lets say we have a game and the variables and content remains the same through out the game. We load initialize everything at the start of the game. The Rollback system should after it reaches its limit have the exact same time effect each new scene.
It pushes one off at one end and adds the new scene at the other. That means rollback routine is a constant factor. It's performance should have the exact same effect every scene / frame.
The only way the roll back feature gets slower over time is if there is a growth in data it needs to copy. In C and C++ copying an array is a bit faster than in python that is especially true if the C and C++ is optimized and fits in the CPU memory space entirely.
Renpy's language though isn't purely python. There is some interpretation in effect going on as well that python is dealing with. So that makes and additional difference in this performance. So I'm not sure how well that ends up being optimized. A well written program isn't going to have an ever expanding call stack. In fact you should be able to set the call stack to a fixed size and never have to worry about it exceeding it. You can do that in C and C++. The times that becomes an issue is when dealing with recursion. All three language C,C++ and python have recursion limits. C and C++ are caused by stack over flow limits. You can however specify stack size when compiling the program.
So the fact the rollback feature copies the stack isn't the issue. The issue is the growth in the stack that shouldn't exist.
Over time even if you disable the rollback entirely it would still cause a problem at some point. Either you are going to run into the limit of the python array size or you will run into a set stack size limit. Apparently this was realize at some point or they wouldn't really had a need to make pop_call() public function it could have just been used by the return function.
Trying to say the problem is the roll back is tantamount to saying the car is bad because the breaks need replacing.
The underlying issue that is a problem is the breaks need fixing or in this case the program is poorly written causing stack growth.
It will be a bit before I can respond. Great talk AON