Skip to content

Optimize writeListFloat32 for Float32List handling - #9266

Open
sanskarIN wants to merge 1 commit into
google:masterfrom
sanskarIN:patch-5
Open

sanskarIN wants to merge 1 commit into
google:masterfrom
sanskarIN:patch-5

Conversation

@sanskarIN

Copy link
Copy Markdown

Description

Optimize Builder.writeListFloat32() for Float32List values.

When the supplied list is a Float32List on a little-endian host, the
implementation copies the underlying byte representation directly instead of
iterating over every element.

Regular List<double> values continue to use the existing element-by-element
implementation.

Changes

  • Add a Float32List fast path to writeListFloat32().
  • Copy the typed-data bytes directly into the builder buffer.
  • Preserve the existing fallback for regular List<double> values.

Related Issue

Fixes #8916

Testing

The existing element-by-element path remains unchanged for regular
List<double> values. A follow-up test change will add explicit
Float32List coverage.

@google-cla

google-cla Bot commented Sep 20, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize Dart Builder.writeListFloat32() for Float32List

1 participant