hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 57ab503bfb48caa70fd3366530b4d3d86a4c3726
parent 2afd766174d392067b2e80013dfe6b362ea60cb3
Author: Alexey Yerin <yyp@disroot.org>
Date:   Mon, 30 Oct 2023 23:56:42 +0300

sort: Get rid of memmove and bring back bounds checks

Those were premature optimizations and don't have a significant impact. Sort
performance issues have deeper roots and need more investigation.

Signed-off-by: Alexey Yerin <yyp@disroot.org>

Diffstat:
Mmakefiles/freebsd.aarch64.mk | 2+-
Mmakefiles/freebsd.riscv64.mk | 2+-
Mmakefiles/freebsd.x86_64.mk | 2+-
Mmakefiles/linux.aarch64.mk | 2+-
Mmakefiles/linux.riscv64.mk | 2+-
Mmakefiles/linux.x86_64.mk | 2+-
Msort/sort.ha | 1-
7 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/makefiles/freebsd.aarch64.mk b/makefiles/freebsd.aarch64.mk @@ -148,7 +148,7 @@ $(HARECACHE)/encoding_hex.ssa: $(encoding_hex_ha) $(HARECACHE)/ascii.td $(HARECA @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/encoding_hex.ssa -t $(HARECACHE)/encoding_hex.td.tmp -N encoding::hex $(encoding_hex_ha) sort_ha = sort/bisect.ha sort/search.ha sort/sort.ha sort/types.ha -$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/rt.td $(HARECACHE)/types.td +$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/types.td @mkdir -p -- "$(HARECACHE)" @printf 'HAREC\t%s\n' "$@" @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/sort.ssa -t $(HARECACHE)/sort.td.tmp -N sort $(sort_ha) diff --git a/makefiles/freebsd.riscv64.mk b/makefiles/freebsd.riscv64.mk @@ -148,7 +148,7 @@ $(HARECACHE)/encoding_hex.ssa: $(encoding_hex_ha) $(HARECACHE)/ascii.td $(HARECA @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/encoding_hex.ssa -t $(HARECACHE)/encoding_hex.td.tmp -N encoding::hex $(encoding_hex_ha) sort_ha = sort/bisect.ha sort/search.ha sort/sort.ha sort/types.ha -$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/rt.td $(HARECACHE)/types.td +$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/types.td @mkdir -p -- "$(HARECACHE)" @printf 'HAREC\t%s\n' "$@" @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/sort.ssa -t $(HARECACHE)/sort.td.tmp -N sort $(sort_ha) diff --git a/makefiles/freebsd.x86_64.mk b/makefiles/freebsd.x86_64.mk @@ -148,7 +148,7 @@ $(HARECACHE)/encoding_hex.ssa: $(encoding_hex_ha) $(HARECACHE)/ascii.td $(HARECA @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/encoding_hex.ssa -t $(HARECACHE)/encoding_hex.td.tmp -N encoding::hex $(encoding_hex_ha) sort_ha = sort/bisect.ha sort/search.ha sort/sort.ha sort/types.ha -$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/rt.td $(HARECACHE)/types.td +$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/types.td @mkdir -p -- "$(HARECACHE)" @printf 'HAREC\t%s\n' "$@" @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/sort.ssa -t $(HARECACHE)/sort.td.tmp -N sort $(sort_ha) diff --git a/makefiles/linux.aarch64.mk b/makefiles/linux.aarch64.mk @@ -166,7 +166,7 @@ $(HARECACHE)/encoding_hex.ssa: $(encoding_hex_ha) $(HARECACHE)/ascii.td $(HARECA @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/encoding_hex.ssa -t $(HARECACHE)/encoding_hex.td.tmp -N encoding::hex $(encoding_hex_ha) sort_ha = sort/bisect.ha sort/search.ha sort/sort.ha sort/types.ha -$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/rt.td $(HARECACHE)/types.td +$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/types.td @mkdir -p -- "$(HARECACHE)" @printf 'HAREC\t%s\n' "$@" @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/sort.ssa -t $(HARECACHE)/sort.td.tmp -N sort $(sort_ha) diff --git a/makefiles/linux.riscv64.mk b/makefiles/linux.riscv64.mk @@ -166,7 +166,7 @@ $(HARECACHE)/encoding_hex.ssa: $(encoding_hex_ha) $(HARECACHE)/ascii.td $(HARECA @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/encoding_hex.ssa -t $(HARECACHE)/encoding_hex.td.tmp -N encoding::hex $(encoding_hex_ha) sort_ha = sort/bisect.ha sort/search.ha sort/sort.ha sort/types.ha -$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/rt.td $(HARECACHE)/types.td +$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/types.td @mkdir -p -- "$(HARECACHE)" @printf 'HAREC\t%s\n' "$@" @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/sort.ssa -t $(HARECACHE)/sort.td.tmp -N sort $(sort_ha) diff --git a/makefiles/linux.x86_64.mk b/makefiles/linux.x86_64.mk @@ -166,7 +166,7 @@ $(HARECACHE)/encoding_hex.ssa: $(encoding_hex_ha) $(HARECACHE)/ascii.td $(HARECA @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/encoding_hex.ssa -t $(HARECACHE)/encoding_hex.td.tmp -N encoding::hex $(encoding_hex_ha) sort_ha = sort/bisect.ha sort/search.ha sort/sort.ha sort/types.ha -$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/rt.td $(HARECACHE)/types.td +$(HARECACHE)/sort.ssa: $(sort_ha) $(HARECACHE)/math.td $(HARECACHE)/types.td @mkdir -p -- "$(HARECACHE)" @printf 'HAREC\t%s\n' "$@" @$(TDENV) $(HAREC) $(HARECFLAGS) -o $(HARECACHE)/sort.ssa -t $(HARECACHE)/sort.td.tmp -N sort $(sort_ha) diff --git a/sort/sort.ha b/sort/sort.ha @@ -194,7 +194,6 @@ fn merge( r *= itemsz; const items = items: *[*]u8; - const aux = aux: *[*]u8; // Placing items at the beginning results in better cache performance // (probably) aux[..m - l] = items[l..m];