Skip to content

UTF-16 sort order is not wrong #3

@sffc

Description

@sffc

I see two main use cases for sorting in an isolated JS environment (interop aside, #4):

  1. A total ordering for use in a BTree-like data structure
  2. A human-readable ordering

(1) is served by UTF-16 ordering. (2) is better-served by Intl.Collator.

There is no reason to use code point ordering for a JS-internal data structure. In fact, it is harmful since no sort order is likely to be faster than UTF-16 order.

The README seems to have an underlying assumption that UTF-16 order is "wrong" in some way. For example, it suggests that if we weren't beholden to the web reality, JS might consider using this behavior for the < operator.

Metadata

Metadata

Assignees

No one assigned

    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