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
Litegraph makes some good use of typed arrays, however there are growing drawbacks and limitations.
Typescript does not fully support typed arrays
Despite being fixed-length by design, it cannot be used in type inference
Tuples become painful to manage
Narrowing types sometimes requires runtime checks, potentially causing performance loss rather than gain
Many third party libraries do not support them
Adds complexity to consumer code
Limits flexibility
This is resulting in needless abstractions and extraneous type-checking.
Suggestion is to convert internal use of Float32Array to number[], where appropriate. e.g. pos, size, and other places. In the render pass, arrays are used as fast memory buffers, and this usage is probably fine as is (or converted to Float64Array).
Impact / checks:
Precision (number not being 32bit)
Refactoring
Downstream consumers relying on Float32Array (it is far more common for consumers to replace the initial Float32Array properties with number[])
Over/underflow behaviour
Performance (likely negligible on modern engines and hardware - should be proactively tested in this case)
The text was updated successfully, but these errors were encountered:
Litegraph makes some good use of typed arrays, however there are growing drawbacks and limitations.
This is resulting in needless abstractions and extraneous type-checking.
Suggestion is to convert internal use of
Float32Array
tonumber[]
, where appropriate. e.g.pos
,size
, and other places. In the render pass, arrays are used as fast memory buffers, and this usage is probably fine as is (or converted toFloat64Array
).Impact / checks:
number
not being 32bit)Float32Array
(it is far more common for consumers to replace the initialFloat32Array
properties withnumber[]
)The text was updated successfully, but these errors were encountered: