Replies: 2 comments 7 replies
-
Changing a method's return type breaks compatibility, so this would need to be implemented as a new method without changing the existing one. |
Beta Was this translation helpful? Give feedback.
-
But this python code isn't necessarily easy to work with, it requires you to be able to encode your sorting scheme as a 64 bit integer How would you, for example, sort This scheme is very specific, and isn't trivial to apply to general situations How, for example, would you handle sorting arrays lexicographically? Or sort different data types where you'd want to sort by type as well? Edit: While this sorting method can run faster (with specific data, it's very limited) it requires a lot of extra storage so it's costly still, so unless we just sort the returned keys by normal means (which doesn't run any faster) we need a lot of extra memory and to add algorithms we are not currently supporting |
Beta Was this translation helpful? Give feedback.
-
I was sorting enemies in an array by x, y coordinates and by debugging i see that the custom sorting function "pos_sort" is called very often. Sorting 10 enemies calls the sorting function 192 times. I guess the cause is the custom sorting function can only give boolean back. The same sorting in python where the sorting function can give a sorting value back instead of boolean takes only 10 calls.
I did no timing measures and have actual no performing problems but i would like to see the sorting like in python via value instead of boolean. The sorting via value gives also more control so you can sort by multiple criteria at once.
gdscript (pos_sort is called 192 times)
python (pos_sort is called 10 times)
Beta Was this translation helpful? Give feedback.
All reactions