Skip to content

Support for all primitive array types (i16, u8, f32, etc.) #3

@Permille

Description

@Permille

I have a feeling that limiting this proposal to only work on i8 arrays (i.e. (array i8) and (array (mut i8))) would not really bring any benefits with regard to ease of implementation, and would only preclude other potential use-cases. Given that the current version of this proposal already assumes that i8 arrays are likely to be backed by some packed memory buffer through which performant multi-byte accesses are possible, I don't think it's a stretch to further assume that all array types with any primitive or packed numeric type will be backed by untyped memory buffers which can also support multibyte array accesses.

For example, the JS String Builtins proposal works with the (array (mut i16)) type to represent UTF-16 characters in strings. By limiting this proposal to just i8 arrays, it would still not be possible to speed up certain string operations with SIMD, which could otherwise enable faster parsing, string lookups, regular expressions, etc. Remember that in the current GC proposal, there is no way to cast between different array types.

@brendandahl let me know what you think about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions