Skip to content

std(sort): reduce INSERTION_SORT_THRESHOLD constant to 48 #1978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion std/assembly/util/sort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type Comparator<T> = (a: T, b: T) => i32;
// @ts-ignore: decorator
@lazy @inline const EMPTY = u32.MAX_VALUE;
// @ts-ignore: decorator
@inline const INSERTION_SORT_THRESHOLD = 128;
@inline const INSERTION_SORT_THRESHOLD = 48;
// @ts-ignore: decorator
@inline const MIN_RUN_LENGTH = 32;

Expand Down
12 changes: 6 additions & 6 deletions tests/compiler/std/array.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -5019,7 +5019,7 @@
(local $15 i32)
(local $16 f32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -5927,7 +5927,7 @@
(local $15 i32)
(local $16 f64)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -6785,7 +6785,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -7598,7 +7598,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -8405,7 +8405,7 @@
i32.store offset=8
block $folding-inner0
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -12455,7 +12455,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down
20 changes: 10 additions & 10 deletions tests/compiler/std/array.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -7225,7 +7225,7 @@
(local $21 i32)
(local $22 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -8248,7 +8248,7 @@
(local $21 i32)
(local $22 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -9299,7 +9299,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -10214,7 +10214,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -11127,7 +11127,7 @@
i32.const 0
i32.store offset=8
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -12059,7 +12059,7 @@
i32.const 0
i32.store offset=8
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -12974,7 +12974,7 @@
i32.const 0
i32.store offset=8
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -13802,7 +13802,7 @@
i32.const 0
i32.store offset=8
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -14989,7 +14989,7 @@
i32.const 0
i32.store offset=8
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -20669,7 +20669,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down
20 changes: 10 additions & 10 deletions tests/compiler/std/typedarray.optimized.wat
Original file line number Diff line number Diff line change
Expand Up @@ -3468,7 +3468,7 @@
(local $15 i32)
(local $16 f64)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -29643,7 +29643,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -30427,7 +30427,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -31261,7 +31261,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -32089,7 +32089,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -32927,7 +32927,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -33749,7 +33749,7 @@
(local $12 i64)
(local $13 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -34580,7 +34580,7 @@
(local $14 i32)
(local $15 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -35411,7 +35411,7 @@
(local $14 i32)
(local $15 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -36243,7 +36243,7 @@
(local $15 i32)
(local $16 f32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down
20 changes: 10 additions & 10 deletions tests/compiler/std/typedarray.untouched.wat
Original file line number Diff line number Diff line change
Expand Up @@ -4040,7 +4040,7 @@
(local $21 i32)
(local $22 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -31802,7 +31802,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -32732,7 +32732,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -33719,7 +33719,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -34649,7 +34649,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -35593,7 +35593,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -36517,7 +36517,7 @@
(local $19 i32)
(local $20 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -37447,7 +37447,7 @@
(local $21 i32)
(local $22 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -38377,7 +38377,7 @@
(local $21 i32)
(local $22 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down Expand Up @@ -39307,7 +39307,7 @@
(local $21 i32)
(local $22 i32)
local.get $1
i32.const 128
i32.const 48
i32.le_s
if
local.get $1
Expand Down