You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of Int64 stores the underlying integer as 3 integer fields:
classInt64implementsIntX {
// A 64-bit integer is represented internally as three non-negative// integers, storing the 22 low, 22 middle, and 20 high bits of the// 64-bit value.finalint _l, _m, _h;
...
}
Operations to/from a Dart int as well as arithmetic/bitwise operations will be slow due to need to operate on the combination of three fields.
On platforms such as the Dart VM or Dart2WasmGC we have support for unboxed int64 values where this overhead can be entirely avoided.
There's two improvements
Use e.g. conditional imports to select better representation for Int64 on VM / Dart2WasmGC than for Dart2Js
Possibly avoid the creation of Int64 boxes entirely by having mechanism to pass unboxed values around
I think with inline class we could even consider going all in and making Int64 an unboxed value. It's going to be a breaking change but much smaller one then before.
I think with inline class we could even consider going all in and making Int64 an unboxed value. It's going to be a breaking change but much smaller one then before.
I was thinking the same. But inline classes afaik are restricted to one member, so for dart2js one still needs multiple integers to represent an int64. Maybe it could be one inline class that is either based on unboxed int64 on VM or on a boxed value for dart2js.
The current implementation of
Int64
stores the underlying integer as 3 integer fields:Operations to/from a Dart int as well as arithmetic/bitwise operations will be slow due to need to operate on the combination of three fields.
On platforms such as the Dart VM or Dart2WasmGC we have support for unboxed int64 values where this overhead can be entirely avoided.
There's two improvements
Int64
on VM / Dart2WasmGC than for Dart2JsInt64
boxes entirely by having mechanism to pass unboxed values around/cc @askeksa-google (since we just talked about it), @osa1 , @mraleph
The text was updated successfully, but these errors were encountered: