From f38aa5a70ff1244e0e3a88c4980b1e87274c0741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Mon, 20 Apr 2015 18:09:04 +0200 Subject: erts: Brute force float comparisons as well Increases float comparison speed by ~120% --- erts/emulator/beam/utils.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'erts/emulator/beam') 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); -- cgit v1.2.3