Repository navigation
Conversation
e-kayrakli
approved these changes
Feb 18, 2026
ajpotts
force-pushed
the
5415_Performance_regresion_from_divide_by_zero_check
branch
from
February 18, 2026 18:19
6debb8a to
2684656
Compare
ajpotts
force-pushed
the
5415_Performance_regresion_from_divide_by_zero_check
branch
2 times, most recently
from
February 18, 2026 20:17
54d3209 to
2d66581
Compare
ajpotts
force-pushed
the
5415_Performance_regresion_from_divide_by_zero_check
branch
from
February 18, 2026 21:09
2d66581 to
2a9f4be
Compare
ajpotts
marked this pull request as ready for review
February 19, 2026 09:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a performance regression introduced by divide-by-zero handling in
pdarraybinary operations. The previous implementation eagerly scanned denominators (e.g.,any(x2 == 0)) on every vector/vector divide and reverse-divide, adding an extra full-array pass (and typically allocating a temporary boolean array) even when the divide error mode is set toignore.Problem
divide="ignore"), these checks should be a no-op, but the eager scan still occurred, causing unnecessary work and a measurable slowdown.Solution
_dbz_checkto:dividemode isignore(fast path).arkouda.numpy.err.handleto support all configured behaviors (warn,raise,call,print,log) consistently.Key changes
arkouda/numpy/pdarrayclass.py_dbz_check(op, flag)with lazy-capable_dbz_check(op: str, has_zero).warningsusage and dispatch viaakerr.handle("divide", msg).lambda: any(x2 == 0)so the scan only runs when mode !=ignore.Why this is safe
divide="ignore": behavior remains a no-op, now without extra scanning.divide!="ignore": behavior is preserved (and broadened) througherr.handle, which is the standard place for error-mode semantics./and//) and only when a check is required.Testing
Notes
This PR intentionally avoids backend changes. The improvement comes from eliminating unnecessary Python-level scans in the common
ignoremode while preserving correct behavior forwarn/raiseand other configured error actions.Closes #5415: Performance regresion from divide by zero check