diff options
| author | Pierre Roux | 2019-09-12 19:02:18 +0200 |
|---|---|---|
| committer | Pierre Roux | 2019-11-01 10:21:07 +0100 |
| commit | a2ba4016a64f84193261db9a52196adc39cb5767 (patch) | |
| tree | f8f0facb4d8c99d8bc5f6db34d6b97a58c8216ca /kernel/byterun | |
| parent | dca0135a263717b3a1a1d7c4f054f039dc08109e (diff) | |
Reimplement is_float
is_float was relying on Obj.tag triggering a check that we are in the
OCaml heap which is expensive. On extreme examples, this can lead to a
global 2x speedup.
Thanks to Maxime Dénès and Jacques-Henri Jourdan for their help in
diagnosing this.
Diffstat (limited to 'kernel/byterun')
| -rw-r--r-- | kernel/byterun/coq_float64.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/byterun/coq_float64.h b/kernel/byterun/coq_float64.h index 6814c31642..9fc390bd33 100644 --- a/kernel/byterun/coq_float64.h +++ b/kernel/byterun/coq_float64.h @@ -29,4 +29,8 @@ DECLARE_FUNOP(fsqrt, sqrt(x)) DECLARE_FUNOP(next_up, nextafter(x, INFINITY)) DECLARE_FUNOP(next_down, nextafter(x, -INFINITY)) +value coq_is_double(value x) { + return Val_long(Is_double(x)); +} + #endif /* _COQ_FLOAT64_ */ |
