Skip to content

Commit

Permalink
Direct lookup in ClosedList.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmorgan committed Nov 12, 2024
1 parent b5ff382 commit 883e3a6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkgs/dart_model/lib/src/json_buffer/closed_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ class _ClosedList with ListMixin<Object?> {
@override
Object? operator [](int index) {
RangeError.checkValidIndex(index, this);
final iterator = _ClosedListIterator(_buffer, _pointer, length);
for (var i = -1; i != index; ++i) {
iterator.moveNext();
}
return iterator.current;
final pointer = _pointer + _lengthSize + index * ClosedLists._valueSize;
return _buffer._readAny(pointer);
}

@override
Expand Down

0 comments on commit 883e3a6

Please sign in to comment.