Skip to content

New instruction string.hash #60

Open
@Liedtke

Description

@Liedtke

We have another instruction that is added to v8 for our performance experiments:

  • string.hash(str: string) -> int32, opcode 0xfbaa
  • returns an implementation defined 32 bit hash value

The reasoning for this instruction is that any JavaScript engine already requires hashed strings, so with stringrefs there is already space reserved in the object for it and there are fast engine-internal implementations available handling different kinds of internal string representations etc.
Most languages require hashes for data structures and with stringrefs they can't add a hash property to strings, so keeping an application-defined hash together with the string is difficult / impacts performance.

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