Skip to content

Instantly share code, notes, and snippets.

@SamuXarick
Created December 14, 2023 23:23
Show Gist options
  • Save SamuXarick/fc93c9beebc97747134e5a4ccb3c9dfb to your computer and use it in GitHub Desktop.
Save SamuXarick/fc93c9beebc97747134e5a4ccb3c9dfb to your computer and use it in GitHub Desktop.
What is faster / less cpu intensive?
if (_tile_priorities == null) {
_tile_priorities = { };
for (local noise = 1; noise <= _noisiest_airport_noise; noise++) {
_tile_priorities[noise] <- GSList();
_tile_priorities[noise].Sort(GSList.SORT_BY_VALUE, GSList.SORT_DESCENDING);
}
}
/* Random code here */
/* Method 1 */
if (_tile_priorities[noise].Count() > 0) {
_tile_priorities[noise].AddItem(tile, _tile_priorities[noise].GetValue(_tile_priorities[noise].Begin()) + 1);
} else {
_tile_priorities[noise].AddItem(tile, 0);
}
/* Method 2 */
_tile_priorities[noise].AddItem(tile, _tile_priorities[noise].Count());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment