The Portable Space Code sensor handling code discards and recalculates a double-linked list containing the range of each space object from the 0,0,0 point. This list is used to reduce the amount of effort expended when checking for proximity to other space objects.
This patch reworks the method used to update this sorted range list, and does not free and malloc very small structures to store one piece of information every space object requires. Entries in the list are shuffled around, rather than regenerated. Given that most objects will usually be moving at reasonable speeds, objects will not traverse more than a few places in the list. Therefore starting from the current location (which this patch does) should mean a lot fewer comparisons than scanning the list from the list-head.
Also in this patch is code to reduce to number of recalculations performed by keeping track of which space objects moved since the last sensor update.
The primary changes are:
I will out some benchmarks up here about the changes in execution time once I have gathered the numbers.
This code is provided as a service to the community using the Portable Space Code. By using this code, you agree that the author is not responsible in any way for the results.
This code is provided as a service to the community using the Portable Space Code. By using this code, you agree that the author is not responsible in any way for any damage caused.