Skip to content

optimize HashFunctions.fnv() #8

@brentdmiller

Description

@brentdmiller

yatmatsuda writes:
We use HashFunctions.fnv(Array[Byte]) (norbert code) for hash partitioning the graph data.
We serialize NodeId to a byte array, then this function scans the bytes and calculate the hash value.
HashFunctions.fnv is recursively defined. It takes one byte (key.head) to compute a intermediate value and creates a new array (key.drop(1)) of rest of the data and call recursively until all data are processed. It means we create an array per byte. Too expensive.
We can simply use a while-loop with the array index as the loop variable.

(private ref: CLD-384)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions