Make list clear nulls faster (#80869)

The old version makes a new list of n null values, and removes it from
the given list.

for larger lists, this newer 515 version should be faster and lead to
less list churn.


![image](https://github.com/tgstation/tgstation/assets/7069733/9c23cc8b-06c4-4a54-99b4-2c44608cf434)
This commit is contained in:
Kyle Spier-Swenson
2024-01-09 22:40:00 -07:00
committed by GitHub
parent 620209fafd
commit ae08be5f3d
+2 -4
View File
@@ -403,10 +403,8 @@
* Returns TRUE if the list had nulls, FALSE otherwise
**/
/proc/list_clear_nulls(list/list_to_clear)
var/start_len = list_to_clear.len
var/list/new_list = new(start_len)
list_to_clear -= new_list
return list_to_clear.len < start_len
return (list_to_clear.RemoveAll(null) > 0)
/**
* Removes any empty weakrefs from the list