-
Notifications
You must be signed in to change notification settings - Fork 30
Description
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:
ranx/ranx/data_structures/run.py
Line 152 in 2cae52f
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.