Skip to content

Commit 538109e

Browse files
committed
fannkuch: add shallow-only separators
1 parent 4eb0231 commit 538109e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Benchmark/fannkuch/shallow/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,19 @@ def fannkuch(n: int) -> int:
2626
perm: List[int] = list(range(n))
2727
perm1_ins: Callable[[int, int], None] = perm1.insert
2828
perm1_pop: Callable[[int], int] = perm1.pop
29+
### SHALLOW SEPARATOR ###
2930

3031
while 1:
3132
while r != 1:
3233
count[r - 1] = r
3334
r -= 1
3435

36+
### SHALLOW SEPARATOR ###
3537
if perm1[0] != 0 and perm1[m] != m:
3638
perm = perm1[:]
3739
flips_count: int = 0
3840
k: int = perm[0]
41+
### SHALLOW SEPARATOR ###
3942
while k:
4043
perm[: k + 1] = perm[k::-1]
4144
flips_count += 1

Benchmark/fannkuch/untyped/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,19 @@ def fannkuch(n):
2222
perm = list(range(n))
2323
perm1_ins = perm1.insert
2424
perm1_pop = perm1.pop
25+
### SHALLOW SEPARATOR ###
2526

2627
while 1:
2728
while r != 1:
2829
count[r - 1] = r
2930
r -= 1
3031

32+
### SHALLOW SEPARATOR ###
3133
if perm1[0] != 0 and perm1[m] != m:
3234
perm = perm1[:]
3335
flips_count = 0
3436
k = perm[0]
37+
### SHALLOW SEPARATOR ###
3538
while k:
3639
perm[: k + 1] = perm[k::-1]
3740
flips_count += 1

0 commit comments

Comments
 (0)