Closed Bug 1564117 Opened 5 years ago Closed 5 years ago

Use std::sqrt in fdlibm

Categories

(Core :: JavaScript Engine, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox69 --- wontfix
firefox70 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(2 files)

std::sqrt is required to have an error less than 0.5 ulp, so there's no need to use the slower sqrt implementation from fdlibm.

This improves all fdlibm functions calling sqrt, for example see the results below for hypot and acosh.

// Improves from ~150ms to ~27ms.
function test_hypot() {
    var xs = [1023, 10230];
    var ys = [Math.PI, 2*Math.PI];

    var q = 0;
    var t = dateNow();
    for (var i = 0; i < 1000000; ++i) {
        q += Math.hypot(xs[i & 1], ys[i & 1]);
    }
    return [dateNow() - t, q];
}

// Improves from ~200ms to ~44ms.
function test_acosh() {
    var xs = [1023, 10230];
    var q = 0;
    var t = dateNow();
    for (var i = 0; i < 1000000; ++i) {
        q += Math.acosh(xs[i & 1]);
    }
    return [dateNow() - t, q];
}

std::sqrt is guaranteed to have an error less than 0.5 ulp, so there's no need
to use fdlibm's slower implementation.

This makes it easier to test if modified patch files still apply.

Additionally "--no-backup-if-mismatch" was added to the patch command to
avoid generating ".orig" files.

Depends on D37256

Priority: -- → P1

Pushed by cbrindusan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/67c757b08c76
Part 1: Use std::sqrt in fdlibm. r=arai
https://hg.mozilla.org/integration/autoland/rev/478e22e44bdf
Part 2: Allow to reimport a specific fdlibm commit. r=arai

Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: