Skip to content

Binding: converting a number set of many elements takes seconds and holds the GIL #94

Closed

Description

@fctl-sh

Priority: medium. Deduplicating a number set is quadratic (crates/dynamoxy-py/src/convert.rs, set_to_av calls unique.contains(&number) for each element): set(range(60_000)) takes 3.0 s to convert (0.6 s for 30,000), against 13 ms for a string set of the same size. That item is about 210 KB, which DynamoDB accepts. The conversion runs on the event loop's thread with the GIL held, on both backends, so the loop and every other thread stall. The core's check_set (value/mod.rs) is quadratic too: the whole in-memory put of that set took 6 s, and one of a 60,000-element string set 4.7 s.

Fix: deduplicate with a HashSet (Number is canonical and implements Hash and Eq), and check sets for duplicates the same way.

Found in a review of the library for bugs (fctl session); the fixes that fit in its ten pull requests are #61 to #65, #67 to #70 and #72.

Activity

  1. added
    bug
    rust
    on Oct 30, 2026
  2. added a commit that references this issue on Oct 31, 2026
    fd187b4
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

    bugrust

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions