Skip to content

compile-time lookup tables via syntax extensions #4864

@thestinger

Description

@thestinger

It would be awesome to support building constant lookup tables at compile-time similar to gperf. This is a really common pattern and could potentially be a big performance win in many places (I'm sure rustc has a lot of constant tables).

A really simple proof of concept would sort an array and provide an object implementing the core::container::Map interface (once MutableMap is split out) via binary search.

The naming would be something along the lines of map!, set!, ordered_map! and ordered_set! along with the corresponding types ConstantMap, ConstantSet, ConstantOrderedMap, ConstantOrderedSet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions