Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: use prefer-inline on js and wasm #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/src/extent_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ class ResizableFloat64List {
static const _minCapacity = 16;

@pragma("vm:prefer-inline")
@pragma("wasm:prefer-inline")
@pragma("dart2js:prefer-inline")
double operator [](int index) {
assert(index >= 0 && index < _length);
return _list[index];
}

@pragma("vm:prefer-inline")
@pragma("wasm:prefer-inline")
@pragma("dart2js:prefer-inline")
void operator []=(int index, double value) {
assert(index >= 0 && index < _length);
_list[index] = value;
Expand Down Expand Up @@ -172,13 +176,17 @@ class ExtentList {
int get length => _extents.length;

@pragma("vm:prefer-inline")
@pragma("wasm:prefer-inline")
@pragma("dart2js:prefer-inline")
double operator [](int index) {
assert(_extents.length == _dirty.length);
assert(index >= 0 && index < _extents.length);
return _extents[index];
}

@pragma("vm:prefer-inline")
@pragma("wasm:prefer-inline")
@pragma("dart2js:prefer-inline")
bool isDirty(int index) {
assert(_extents.length == _dirty.length);
assert(index >= 0 && index < _extents.length);
Expand Down
2 changes: 2 additions & 0 deletions lib/src/extent_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class ExtentManager with ChangeNotifier {
int? get cleanRangeEnd => _extentList.cleanRangeEnd;

@pragma("vm:prefer-inline")
@pragma("wasm:prefer-inline")
@pragma("dart2js:prefer-inline")
double getExtent(int index) => _extentList[index];

void resize(
Expand Down