Jump to content
nikiller

append faster than pushBack?

Recommended Posts

Skaronator: It's highly recommended to use the new pushBack command, up to 43% faster than set and up to 11843% faster a plus b!

 

Heeeere's Johnny!:" _array1 append _array2" is roughly 1.2x faster (depending on array size) than "_array1 = _array1 + _array2"

 

You could check with Bis_fnc_codeperformace which of both is even quickter. I go with pushBack all the time, but maybe append is a bit quicker. It was different in my test ... but they were pretty close in 1000 circles of testing with arrays

 

 

Regards Arkensor

  • Like 1

Share this post


Link to post
Share on other sites

pushBack is for adding only one element to array, so when you use it you at the same time give the knowledge of amount of elements (one) to adding function.

Whereas append works for array of arbitrary count of elements to add, so it must first do extra work of defining how much elements is passed for appending and so on.

Not tested, but my bet is that append is faster for adding multiple elements than loop of pushBack's

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×