Leopard20 813 Posted April 10, 2020 Hello everyone. Let's say I want to place array A inside array B: B = [....A....] The dots mean there may be other variables with fixed memory size after or before A (typically some strings or integers in my code). Array A however, may have a variable size (due to using pushBack/append/deleteAt/set for this array), from 0 all the way up to hundreds of elements. In terms of memory allocation speed, is there any difference where you put A inside B? Also, does reading speed (B select _index) vary according to where A is? (I think it doesn't, but asking to make sure) I'm asking this because arrays B and A (and their contents) are read and sometimes modified per frame. Share this post Link to post Share on other sites
gc8 977 Posted April 11, 2020 I'm not sure what you are trying to accomplish, a code example would be better so I could understand :) Share this post Link to post Share on other sites
Leopard20 813 Posted April 11, 2020 1 hour ago, gc8 said: I'm not sure what you are trying to accomplish, a code example would be better so I could understand 🙂 It's a general question. No code is needed. I don't think anyone but the devs can answer it. Hopefully @Dedmen or @Dwarden can help! Share this post Link to post Share on other sites
mrcurry 496 Posted April 11, 2020 14 hours ago, Leopard20 said: Hello everyone. Let's say I want to place array A inside array B: B = [....A....] The dots mean there may be other variables with fixed memory size after or before A (typically some strings or integers in my code). Array A however, may have a variable size (due to using pushBack/append/deleteAt/set for this array), from 0 all the way up to hundreds of elements. In terms of memory allocation speed, is there any difference where you put A inside B? Also, does reading speed (B select _index) vary according to where A is? (I think it doesn't, but asking to make sure) I'm asking this because arrays B and A (and their contents) are read and sometimes modified per frame. Arrays are stored by reference. As long as you know which index A is stored in the answer is: no, where you put A in the B array has no bearing on the access time or memory allocation time. In any practical application "array select 0" and "array select n" are equal in speed. 1 Share this post Link to post Share on other sites
Dedmen 2703 Posted April 13, 2020 On 4/10/2020 at 7:44 PM, Leopard20 said: In terms of memory allocation speed, is there any difference where you put A inside B? no On 4/10/2020 at 7:44 PM, Leopard20 said: Also, does reading speed (B select _index) vary according to where A is? (I think it doesn't, but asking to make sure) no 1 Share this post Link to post Share on other sites
Leopard20 813 Posted April 13, 2020 5 hours ago, Dedmen said: no no Good to know! 🙂 Thanks Share this post Link to post Share on other sites