Skip to content

Conversation

@ajpotts
Copy link
Contributor

@ajpotts ajpotts commented Jan 30, 2026

Closes #5373: where to allow bool_scalars

@ajpotts ajpotts force-pushed the 5373_where_to_allow_bool_scalars branch 2 times, most recently from 4b375b6 to edfa2e4 Compare February 9, 2026 23:57
@ajpotts ajpotts force-pushed the 5373_where_to_allow_bool_scalars branch 3 times, most recently from 94248d4 to 78843f6 Compare February 10, 2026 11:10
@ajpotts ajpotts marked this pull request as ready for review February 10, 2026 11:31
Copy link
Contributor

@1RyanK 1RyanK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor performance issue on

In [7]: import time
   ...: import arkouda as ak
   ...: 
   ...: n = 20_000_000
   ...: x = ak.ones(n, dtype=ak.int64)
   ...: y = ak.zeros(n, dtype=ak.int64)
   ...: 
   ...: def time_where(cond):
   ...:     t0 = time.time()
   ...:     r = ak.where(cond, x, y)
   ...:     # force evaluation
   ...:     s = int(r.sum())
   ...:     t1 = time.time()
   ...:     return (t1 - t0), s
   ...: 
   ...: # Baseline: just sum x directly (should be fast-ish, no where mask)
   ...: t0 = time.time()
   ...: sx = int(x.sum())
   ...: t1 = time.time()
   ...: print("baseline x.sum() sec:", round(t1-t0, 3), "sum:", sx)
   ...: 
   ...: dt_true, s_true = time_where(True)
   ...: print("where(True, x, y) sec:", round(dt_true, 3), "sum:", s_true)
   ...: 
   ...: dt_false, s_false = time_where(False)
   ...: print("where(False, x, y) sec:", round(dt_false, 3), "sum:", s_false)
   ...: 
baseline x.sum() sec: 0.023 sum: 20000000
where(True, x, y) sec: 0.13 sum: 20000000
where(False, x, y) sec: 0.122 sum: 0

@ajpotts ajpotts force-pushed the 5373_where_to_allow_bool_scalars branch from 78843f6 to aeb5ae7 Compare February 11, 2026 16:37
Copy link
Contributor

@jaketrookman jaketrookman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@ajpotts ajpotts force-pushed the 5373_where_to_allow_bool_scalars branch from c9ad74d to 361c42d Compare February 11, 2026 21:39
@ajpotts ajpotts merged commit 66c3e08 into Bears-R-Us:main Feb 11, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

where to allow bool_scalars

3 participants