Skip to content

change TaggedLen to store on_heap on MSB #569

Closed as not planned
Closed as not planned

Description

@alejandro-vaz

currently, our tagged length stores on the least significant bit the marker for whether the allocation is on the heap or on the stack

changing it to the MSB will allow to make incrementing/decrementing by any value simple additions/subtractions which would improve performance

however, throughout the codebase we don't make use of direct addition/subtraction to TaggedLen, and instead we rely on replacing the instance and keeping a counter on the fly, which is not nice and has unnecessary overhead. #570 aims to change this

this issue only addresses changing to MSB

Activity

  1. added this to the v2-beta.1 milestone on Sep 3, 2026
  2. fereidani commented on Sep 3, 2026

    @fereidani
    Contributor

    It is a dead-end and waste of time, I couldn't make it work, I achieved 4-5% improvement in push benchmarks and up to 20-40% regression in some other benchmarks. I tried really hard but it seems LLVM can't generate optimized code for it.
    I ended up with more asm instructions and general regression in all benchmarks combined.

  3. alejandro-vaz commented on Sep 3, 2026

    @alejandro-vaz
    CollaboratorAuthor

    yeah that's exactly the conclusion I came to, but maybe we are doing something wrong

  4. fereidani commented on Sep 3, 2026

    @fereidani
    Contributor

    Maybe, But I believe I did the best I could, I won't put any more time on it. Maybe someone else wants to give it another shot.

  5. alejandro-vaz commented on Sep 3, 2026

    @alejandro-vaz
    CollaboratorAuthor

    I don't think it's worth it, we both tried and failed, that's enough evidence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for a first contributorhelp wantedNo clear candidate to implement itr-refactorrelated to refactoring

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions