Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/js/src/jit-test/tests/ion/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 792 B image not shown  

Quelle  object-keys-00.js   Sprache: JAVA

 
// This test case is used to test the optimized code path where the computation
// of `Object.keys(...).length` no longer compute `Object.keys(...)` as an
// intermediate result.
//
// This test verifies that the result remain consistent after the optimization.

function cmp_keys_length(a, b) {
    return Object.keys(a).length == Object.keys(b).length;
}

let objs = [
    {x:0, a: 1, b: 2},
    {x:1, b: 1, c: 2},
    {x:2, c: 1, d: 2},
    {x:3, a: 1, b: 2, c: 3},
    {x:4, b: 1, c: 2, d: 3},
    {x:5, a: 1, b: 2, c: 3, d: 4}
];

function max_of(o) {
    return o?.d ?? o?.c ?? o?.b ?? 0;
}

with({}) {}
for (let i = 0; i < 1000; i++) {
    for (let o1 of objs) {
        for (let o2 of objs) {
            assertEq(cmp_keys_length(o1, o2), max_of(o1) == max_of(o2));
        }
    }
}

Messung V0.5
C=84 H=15 G=60

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.