Skip to content

Faster AA sampling #350

Closed
Closed

Description

@jakobnissen

We might be able to randomly sample 8 AAs at a time by sampling from 0:20^8 - 1, and then computing each base-20 digit in parallel, before reinterpret'ing to UInt64.
Something like

function foo(rng)
    x = rand(rng, UInt(0):UInt(20)^8-1)
    a = div(x, 20^0) % 20^1
    b = div(x, 20^1) & 20^2
   .....
   return reinterpret(UInt64, (a, b, c, ... h))
end

Also benchmark compared to just a normal divrem chain (which LLM may reorder), and also benchmark compared to status quo

Activity

  1. jakobnissen commented on Sep 1, 2026

    @jakobnissen
    MemberAuthor

    Benchmarking reveals this is only ~60% faster, so I don't think it's worth it.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions