aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-04-20 18:09:04 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-04-22 14:01:31 +0200
commitf38aa5a70ff1244e0e3a88c4980b1e87274c0741 (patch)
treede0d67bf241886803b132e40ff253a37133ae2f8 /erts
parent6ba93050fa369626b22cc608c7f874148bb0e5c1 (diff)
downloadotp-f38aa5a70ff1244e0e3a88c4980b1e87274c0741.tar.gz
otp-f38aa5a70ff1244e0e3a88c4980b1e87274c0741.tar.bz2
otp-f38aa5a70ff1244e0e3a88c4980b1e87274c0741.zip
erts: Brute force float comparisons as well
Increases float comparison speed by ~120%
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index edefc5170f..8f6335d5dd 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -2938,6 +2938,11 @@ Sint erts_cmp(Eterm a, Eterm b, int exact, int eq_only)
return cmp_atoms(a, b);
} else if (is_both_small(a, b)) {
return (signed_val(a) - signed_val(b));
+ } else if (is_float_rel(a, a_base) && is_float_rel(b, b_base)) {
+ FloatDef af, bf;
+ GET_DOUBLE_REL(a, af, a_base);
+ GET_DOUBLE_REL(b, bf, b_base);
+ return float_comp(af.fd, bf.fd);
}
#if HALFWORD_HEAP
return erts_cmp_compound_rel_opt(a,a_base,b,b_base,exact,eq_only);