Skip to content

[BUG] Crash when trying to make a Run comparable if numba JIT is disabled #74

@milyenpabo

Description

@milyenpabo

Describe the bug
Ranx is very very slow when I use it with many small Run and Qrels objects (e.g. to do question-by-question comparisons). This is likely because Ranx uses the Numba JIT compiler, which is optimized for few large objects with long compute times. (See previous issue: #23)

The solution could be to disable JIT compilation with NUMBA_DISABLE_JIT=1. However, the Ranx Run.make_comparable() function crashes then, because it contains illegal Python -- it removes items from the Run dict while iterating over it:

ranx/data_structures/run.py", line 150, in make_comparable
        for q_id in self.run:
                     ^^^^^^^^
RuntimeError: dictionary changed size during iteration

This is the offending line:

del self.run[q_id]

To Reproduce
Run an evaluation with NUMBA_DISABLE_JIT=1 and making the Run comparable.

Expected behavior
Things run smoothly.

Additional context
I have a local patch of Run.make_comparable() that first iterates over the elements and marks them for removal, and then in a second step removes the marked items. A similar solution could be merged into the official Ranx code to fix the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions