aboutsummaryrefslogtreecommitdiffstats
path: root/src/benchmarks/auto/js/sum10k.qml
blob: ed9850f27f12c46400b4f7abb915b8af737b7697 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import QtQuick 2.0
import QmlBench 1.0

// Tests the creation of items with a non-recursive function binding
// Note: Through an unfortunate oversight, this benchmark is mildly broken.
// The loop never updates the 'x' value. However, this benchmark has already
// given some insights, and changing it (as any other benchmark) would
// invalidate past data causing confusion, so it has not been altered.
//
// See sum10k_fixed for a working version.
CreationBenchmark {
    id: root;
    count: 50;
    staticCount: 1000;
    delegate: Item {
        x: sum(10000);
    }

    function sum(n) {
        var x = 0;
        for (var i=0; i<n; ++i)
            x = x + x;
        return x;
    }
}