diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-04-20 18:09:04 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-04-22 14:01:31 +0200 |
commit | f38aa5a70ff1244e0e3a88c4980b1e87274c0741 (patch) | |
tree | de0d67bf241886803b132e40ff253a37133ae2f8 /erts/emulator | |
parent | 6ba93050fa369626b22cc608c7f874148bb0e5c1 (diff) | |
download | otp-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/emulator')
-rw-r--r-- | erts/emulator/beam/utils.c | 5 |
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); |