Skip to content

[performance] Bytes::from_fixedarray() should be a simple memcpy or no-op on native/llvm backend #2596

@tonyfettes

Description

@tonyfettes

For now the Bytes::from_fixedarray allocates closures because it uses Bytes::makei:

pub fn Bytes::from_fixedarray(arr : FixedArray[Byte], len? : Int) -> Bytes {
  let len = match len {
    None => arr.length()
    Some(x) => x
  }
  Bytes::makei(len, i => arr[i])
}

Using simple memcpy or, better, no-op will be much better as there will be no allocate when writing each individual element.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions