How does TableItems() work from power point of view.
Posted: Fri Jun 02, 2023 10:02 am
As I am wondering about how to optimize my code faster, I was starting to wonder about a solution involving TableItems() command, but main question regarding it is that does TableItems() slow down if Table is bigger.
As in:
Now when using TableItem() to find out how many items these have, is Table1 getting result faster than table2, and if it is getting result faster, then is the difference directly 50 times slowe to get Table2?
That does it actually go through every item to see there are items, or is it able to simply check reserved memory space for Table2 to figure out how many items there are?
To give more details about the situation is that I have pathfinding that is currently checking 90 steps away at max, this is in case source is on one edge of map, and target is on other side of map.
However, I was thinking that since this situation is very unlikely, I could maybe stop checking after 70 steps already, and in case it results in no target at all, then it could simply pick one of the targets at random, since i do keep the targets in table, so I could use TableItems() to get the amount of potential targets, and then just randomly pick one of them and take a direct line towards it. This could significantly improve the speed in these rare situations and might not affect the play experience much, making it more possible to work on Amigas.
As in:
Code: Select all
Table1 = { 1, 2 }
Table2 = {1, 2, 3, 4, 5... 100}That does it actually go through every item to see there are items, or is it able to simply check reserved memory space for Table2 to figure out how many items there are?
To give more details about the situation is that I have pathfinding that is currently checking 90 steps away at max, this is in case source is on one edge of map, and target is on other side of map.
However, I was thinking that since this situation is very unlikely, I could maybe stop checking after 70 steps already, and in case it results in no target at all, then it could simply pick one of the targets at random, since i do keep the targets in table, so I could use TableItems() to get the amount of potential targets, and then just randomly pick one of them and take a direct line towards it. This could significantly improve the speed in these rare situations and might not affect the play experience much, making it more possible to work on Amigas.