Skip to content

Commit

Permalink
perf: improved performance of TabularDataset.__eq__ by a factor of …
Browse files Browse the repository at this point in the history
…up to 2 (#697)

### Summary of Changes

perf: improved performance of `TabularDataset.__eq__` by a factor of up
to 2
perf: slightly improved performance of `TabularDataset.__hash__`
fix: corrected `TabularDataset.__sizeof__`

---------

Co-authored-by: megalinter-bot <[email protected]>
  • Loading branch information
Marsmaennchen221 and megalinter-bot authored May 6, 2024
1 parent 102de2d commit cd7f55b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/safeds/data/labeled/containers/_tabular_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def __eq__(self, other: object) -> bool:
return NotImplemented
if self is other:
return True
return self.target == other.target and self.features == other.features and self._table == other._table
return self.target == other.target and self.features == other.features and self._extras == other._extras

def __hash__(self) -> int:
"""
Expand All @@ -105,7 +105,7 @@ def __hash__(self) -> int:
hash:
The hash value.
"""
return _structural_hash(self.target, self.features, self._table)
return _structural_hash(self.target, self.features, self._extras)

def __sizeof__(self) -> int:
"""
Expand All @@ -116,7 +116,7 @@ def __sizeof__(self) -> int:
size:
Size of this object in bytes.
"""
return sys.getsizeof(self._target) + sys.getsizeof(self._features) + sys.getsizeof(self._table)
return sys.getsizeof(self._target) + sys.getsizeof(self._features) + sys.getsizeof(self._extras)

# ------------------------------------------------------------------------------------------------------------------
# Properties
Expand Down

0 comments on commit cd7f55b

Please sign in to comment.