Skip to content

Commit ea51fe2

Browse files
committed
Seems to compile
1 parent dfc2188 commit ea51fe2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

benchmark_v2/optional/concatenate_uniquely_benchmark.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
# 1 => ak.unique(ak.concatenate([a, b], ordered=False))
1313
# 2 => Strings.concatenate_uniquely([a, b])
14-
METHOD = (1, 2)
14+
# 3 => Strings.concatenate_uniquely_with_inner_arrays([a, b])
15+
METHOD = (1, 2, 3)
1516

1617

1718
def _unique_concat(a: Strings, b: Strings) -> Strings:
@@ -22,6 +23,10 @@ def _concatenate_uniquely(a: Strings, b: Strings) -> Strings:
2223
return Strings.concatenate_uniquely([a, b])
2324

2425

26+
def _concatenate_uniquely_inner_arrays(a: Strings, b: Strings) -> Strings:
27+
return Strings.concatenate_uniquely_with_inner_arrays([a, b])
28+
29+
2530
@pytest.mark.skip_numpy(True)
2631
@pytest.mark.benchmark(group="AK_strings_concat_unique")
2732
@pytest.mark.parametrize("overlap", OVERLAP)
@@ -76,7 +81,8 @@ def bench_strings_concat_unique(benchmark, overlap, method):
7681
bytes_b = calc_num_bytes(b)
7782
num_bytes = bytes_a + bytes_b
7883

79-
fn = _unique_concat if method == 1 else _concatenate_uniquely
84+
fns = [_unique_concat, _concatenate_uniquely, _concatenate_uniquely_inner_arrays]
85+
fn = fns[method]
8086

8187
benchmark.pedantic(
8288
fn,

src/ConcatenateMsg.chpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ module ConcatenateMsg
691691
var locSet = new set(string, parSafe = true);
692692

693693
// Reduce to unique strings within this locale
694-
forall str in myStrings {
694+
forall str in myStrings with (ref locSet) {
695695
locSet.add(str);
696696
}
697697

@@ -724,7 +724,7 @@ module ConcatenateMsg
724724
var strSet = new set(string, parSafe = true);
725725

726726
// Perform another reduction by uniqueness on the strings in this set
727-
forall str in myStrings {
727+
forall str in myStrings with (ref strSet) {
728728
strSet.add(str);
729729
}
730730

0 commit comments

Comments
 (0)