mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
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. 
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user