Skip to content

Conversation

@redmoogle
Copy link
Contributor

The changes in DreamValues.cs provide about 20-30% speedup on equals comparison (900-1000 ticks vs 1300)
The changes in DreamList.cs maybe provide 1-5% speedup (get_count was using about 1.83% cpu)

tested using

var/list/L1 = list()
for (var/i in 1 to 100000)
    L1 += new /datum

var/start = world.timeofday
var/list/L2 = list()
for (var/i in 1 to 100000)
    var/key = L1[i]
    L2[key] = 1
world.log << world.timeofday - start

@boring-cyborg boring-cyborg bot added the Runtime Involves the OpenDream server/runtime label Nov 26, 2025
if (otherObj != null && otherObj.Deleted == true)
other._refValue = null;
break;
return thisObj == otherObj;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not break comparisons with deleted objects? It compares _refValue before the Deleted check.

if (_refValue != null && Unsafe.As<DreamObject>(_refValue).Deleted)
var thisObj = Unsafe.As<DreamObject>(_refValue);
var otherObj = Unsafe.As<DreamObject>(other._refValue);
if (thisObj != null && thisObj.Deleted) {

Check notice

Code scanning / InspectCode

Merge null/pattern checks into complex pattern Note

Merge into pattern
thisObj = null;
}

if (otherObj != null && otherObj.Deleted) {

Check notice

Code scanning / InspectCode

Merge null/pattern checks into complex pattern Note

Merge into pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Runtime Involves the OpenDream server/runtime size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants