├── MotionMark ├── version ├── tests │ ├── resources │ │ ├── yin-yang.png │ │ ├── star.svg │ │ ├── yin-yang.svg │ │ ├── stage.css │ │ └── benchmark.js │ ├── core │ │ ├── resources │ │ │ ├── layout100.png │ │ │ ├── script100.png │ │ │ ├── styles100.png │ │ │ ├── compass100.png │ │ │ ├── console100.png │ │ │ ├── debugger100.png │ │ │ ├── storage100.png │ │ │ ├── timeline100.png │ │ │ ├── contribute100.png │ │ │ ├── inspector100.png │ │ │ ├── performance100.png │ │ │ ├── shortcuts100.png │ │ │ ├── standards100.png │ │ │ ├── layout.svg │ │ │ ├── console.svg │ │ │ ├── inspector.svg │ │ │ ├── timeline.svg │ │ │ ├── debugger.svg │ │ │ ├── performance.svg │ │ │ ├── shortcuts.svg │ │ │ ├── standards.svg │ │ │ ├── styles.svg │ │ │ ├── script.svg │ │ │ ├── compass.svg │ │ │ ├── storage.svg │ │ │ ├── canvas-stage.js │ │ │ ├── contribute.svg │ │ │ ├── particles.js │ │ │ └── focus.js │ │ ├── canvas-stage.html │ │ ├── image-data.html │ │ ├── leaves.html │ │ ├── multiply.html │ │ ├── design.html │ │ └── suits.html │ ├── bouncing-particles │ │ ├── resources │ │ │ ├── image1.jpg │ │ │ ├── image2.jpg │ │ │ ├── image3.jpg │ │ │ ├── image4.jpg │ │ │ ├── image5.jpg │ │ │ ├── bouncing-svg-images.js │ │ │ ├── bouncing-canvas-images.js │ │ │ ├── bouncing-css-images.js │ │ │ ├── bouncing-svg-particles.js │ │ │ ├── bouncing-tagged-images.js │ │ │ ├── bouncing-css-shapes.js │ │ │ ├── bouncing-canvas-shapes.js │ │ │ ├── bouncing-canvas-particles.js │ │ │ └── bouncing-svg-shapes.js │ │ ├── bouncing-svg-images.html │ │ ├── bouncing-svg-shapes.html │ │ ├── bouncing-canvas-shapes.html │ │ ├── bouncing-tagged-images.html │ │ ├── bouncing-css-images.html │ │ ├── bouncing-canvas-images.html │ │ └── bouncing-css-shapes.html │ ├── dom │ │ ├── resources │ │ │ ├── multiply.js │ │ │ ├── compositing-transforms.js │ │ │ ├── leaves.js │ │ │ └── dom-particles.js │ │ ├── compositing-transforms.html │ │ ├── particles.html │ │ ├── leaves.html │ │ ├── focus.html │ │ └── multiply.html │ ├── template │ │ ├── template-css.html │ │ ├── template-svg.html │ │ ├── template-canvas.html │ │ └── resources │ │ │ ├── template-css.js │ │ │ ├── template-svg.js │ │ │ └── template-canvas.js │ ├── simple │ │ ├── tiled-canvas-image.html │ │ ├── simple-canvas-paths.html │ │ └── resources │ │ │ ├── simple-canvas.js │ │ │ └── tiled-canvas-image.js │ ├── 3d │ │ ├── triangles-webgpu.html │ │ └── triangles-webgl.html │ ├── text │ │ ├── design-6.js │ │ ├── design.js │ │ ├── design.html │ │ └── design-6.html │ └── svg │ │ ├── suits.html │ │ └── suits.js ├── unit-tests │ ├── run-unit-tests.html │ └── tests │ │ ├── test-random.js │ │ └── test-statistics.js ├── resources │ ├── runner │ │ ├── tests.js │ │ └── lines.svg │ └── strings.js └── index.html ├── .gitignore ├── README.md ├── index.html ├── LICENSE └── Governance.md /MotionMark/version: -------------------------------------------------------------------------------- 1 | development -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.mode* 2 | *.pyc 3 | .DS_Store 4 | .directory 5 | /node_modules 6 | 7 | .vscode 8 | .angular 9 | -------------------------------------------------------------------------------- /MotionMark/tests/resources/yin-yang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/resources/yin-yang.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MotionMark 2 | 3 | MotionMark is a graphics benchmark to measure the performance of graphics operations on the web. 4 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/layout100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/layout100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/script100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/script100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/styles100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/styles100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/compass100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/compass100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/console100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/console100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/debugger100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/debugger100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/storage100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/storage100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/timeline100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/timeline100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/contribute100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/contribute100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/inspector100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/inspector100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/performance100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/performance100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/shortcuts100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/shortcuts100.png -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/standards100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/core/resources/standards100.png -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/image1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/bouncing-particles/resources/image1.jpg -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/image2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/bouncing-particles/resources/image2.jpg -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/image3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/bouncing-particles/resources/image3.jpg -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/image4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/bouncing-particles/resources/image4.jpg -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/image5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WebKit/MotionMark/HEAD/MotionMark/tests/bouncing-particles/resources/image5.jpg -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | MotionMark 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /MotionMark/tests/resources/star.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/layout.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/console.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/inspector.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/timeline.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/debugger.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MotionMark/tests/resources/yin-yang.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/performance.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/shortcuts.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2017-2023 Apple Inc. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 7 | 8 | THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 9 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/standards.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/styles.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MotionMark/unit-tests/run-unit-tests.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | MotionMark Unit Tests 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 36 | 37 | 38 |

MotionMark Unit Tests

39 |
40 | 41 | 45 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /MotionMark/unit-tests/tests/test-random.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | describe('Random', function() { 27 | it('Check random sequence', function() { 28 | Pseudo.resetRandomSeed(); 29 | expect(Pseudo.randomSeed).to.be(49734321); 30 | expect(Pseudo.random().toFixed(6)).to.be('0.987282'); 31 | expect(Pseudo.random().toFixed(6)).to.be('0.348803'); 32 | expect(Pseudo.random().toFixed(6)).to.be('0.563193'); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/script.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MotionMark/tests/resources/stage.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2017 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | html { 26 | height: 100%; 27 | } 28 | body { 29 | width: 100%; 30 | height: 100%; 31 | margin: 0; 32 | padding: 0; 33 | background-color: rgb(241, 241, 241); 34 | font-family: "Helvetica Neue", Helvetica, Verdana, sans-serif; 35 | } 36 | 37 | #stage { 38 | position: relative; 39 | width: 100%; 40 | height: 100%; 41 | background-color: rgb(241, 241, 241); 42 | overflow: hidden; 43 | } 44 | 45 | #center-text { 46 | position: absolute; 47 | z-index: 3; 48 | top: 50%; 49 | left: 50%; 50 | transform: translate(-50%, -50%); 51 | } 52 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/resources/multiply.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class MultiplyDerivedBenchmark extends MultiplyBenchmark { 27 | constructor(options) 28 | { 29 | switch (options["style"]) { 30 | case "opacity": 31 | options.visibleCSS = [["opacity", 0, 1]]; 32 | break; 33 | case "display": 34 | options.visibleCSS = [["display", "none", "block"]]; 35 | break; 36 | case "visibility": 37 | options.visibleCSS = [["visibility", "hidden", "visible"]]; 38 | break; 39 | } 40 | super(options); 41 | } 42 | } 43 | 44 | window.benchmarkClass = MultiplyDerivedBenchmark; 45 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/compass.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MotionMark/tests/template/template-css.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /MotionMark/tests/template/template-svg.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /MotionMark/tests/template/template-canvas.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /MotionMark/tests/simple/tiled-canvas-image.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /MotionMark/tests/core/canvas-stage.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /MotionMark/resources/runner/tests.js: -------------------------------------------------------------------------------- 1 | var Headers = { 2 | testName: [ 3 | { 4 | title: "" + Strings.text.testName + "", 5 | text: Strings.text.testName 6 | } 7 | ], 8 | score: [ 9 | { 10 | title: Strings.text.score, 11 | text: Strings.json.score 12 | } 13 | ], 14 | details: [ 15 | { 16 | title: " ", 17 | text: function(data) { 18 | var bootstrap = data[Strings.json.complexity][Strings.json.bootstrap]; 19 | return "±" + (Statistics.largestDeviationPercentage(bootstrap.confidenceLow, bootstrap.median, bootstrap.confidenceHigh) * 100).toFixed(2) + "%"; 20 | } 21 | } 22 | ] 23 | }; 24 | 25 | var Suite = function(name, tests) { 26 | this.name = name; 27 | this.tests = tests; 28 | }; 29 | 30 | var Suites = []; 31 | 32 | Suites.push(new Suite("MotionMark", 33 | [ 34 | { 35 | url: "core/multiply.html", 36 | name: "Multiply" 37 | }, 38 | { 39 | url: "core/canvas-stage.html?pathType=arcs", 40 | name: "Canvas Arcs" 41 | }, 42 | { 43 | url: "core/leaves.html", 44 | name: "Leaves" 45 | }, 46 | { 47 | url: "core/canvas-stage.html?pathType=linePath", 48 | name: "Paths" 49 | }, 50 | { 51 | url: "core/canvas-stage.html?pathType=line&lineCap=square", 52 | name: "Canvas Lines" 53 | }, 54 | { 55 | url: "core/image-data.html", 56 | name: "Images" 57 | }, 58 | { 59 | url: "core/design.html", 60 | name: "Design" 61 | }, 62 | { 63 | url: "core/suits.html", 64 | name: "Suits" 65 | }, 66 | ] 67 | )); 68 | 69 | function suiteFromName(name) 70 | { 71 | return Suites.find(function(suite) { return suite.name == name; }); 72 | } 73 | 74 | function testFromName(suite, name) 75 | { 76 | return suite.tests.find(function(test) { return test.name == name; }); 77 | } 78 | -------------------------------------------------------------------------------- /MotionMark/tests/3d/triangles-webgpu.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /MotionMark/resources/runner/lines.svg: -------------------------------------------------------------------------------- 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 | 26 | 27 | -------------------------------------------------------------------------------- /MotionMark/tests/simple/simple-canvas-paths.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/bouncing-svg-images.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/bouncing-svg-shapes.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/bouncing-canvas-shapes.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/bouncing-tagged-images.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
47 | 48 | 49 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/bouncing-css-images.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | 36 | 37 |
38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /MotionMark/tests/core/image-data.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 42 | 43 | 44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /MotionMark/tests/core/leaves.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 38 | 39 | 40 |
41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/compositing-transforms.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 37 | 38 | 39 |
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/particles.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 37 | 38 | 39 |
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/leaves.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 38 | 39 | 40 |
41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/storage.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /MotionMark/unit-tests/tests/test-statistics.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | describe('Statistics', function() { 27 | describe('sampleMean()', function() { 28 | it('sampleMean should compute the mean', function() { 29 | expect(Statistics.sampleMean(10, 100)).to.be(10); 30 | }); 31 | 32 | it('sampleMean with zero samples should be zero', function() { 33 | expect(Statistics.sampleMean(0, 100)).to.be(0); 34 | }); 35 | }); 36 | 37 | describe('geometricMean()', function() { 38 | it('geometricMean should compute the geometric mean', function() { 39 | const values = [6, 2, 3, 5]; 40 | const result = Statistics.geometricMean(values).toFixed(3); 41 | expect(result).to.be('3.663') 42 | }); 43 | 44 | it('geometricMean with a zero should compute to zero', function() { 45 | const values = [6, 2, 0, 5]; 46 | const result = Statistics.geometricMean(values).toFixed(3); 47 | expect(result).to.be('0.000') 48 | }); 49 | }); 50 | }); 51 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-svg-images.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingSvgImage extends BouncingSvgParticle { 27 | constructor(stage) 28 | { 29 | super(stage, "image"); 30 | 31 | var attrs = { x: 0, y: 0, width: this.size.x, height: this.size.y }; 32 | var xlinkAttrs = { href: stage.imageSrc }; 33 | this.element = Utilities.createSVGElement("image", attrs, xlinkAttrs, stage.element); 34 | this._move(); 35 | } 36 | } 37 | 38 | class BouncingSvgImagesStage extends BouncingSvgParticlesStage { 39 | async initialize(benchmark, options) 40 | { 41 | await super.initialize(benchmark, options); 42 | this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg"; 43 | } 44 | 45 | createParticle() 46 | { 47 | return new BouncingSvgImage(this); 48 | } 49 | } 50 | 51 | class BouncingSvgImagesBenchmark extends Benchmark { 52 | constructor(options) 53 | { 54 | super(new BouncingSvgImagesStage(), options); 55 | } 56 | } 57 | 58 | window.benchmarkClass = BouncingSvgImagesBenchmark; 59 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/bouncing-canvas-images.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-canvas-images.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingCanvasImage extends BouncingCanvasParticle { 27 | constructor(stage) 28 | { 29 | super(stage, "image"); 30 | this._imageElement = stage.imageElement; 31 | } 32 | 33 | _draw() 34 | { 35 | this.context.save(); 36 | this.applyRotation(); 37 | this.context.drawImage(this._imageElement, 0, 0, this.size.x, this.size.y); 38 | this.context.restore(); 39 | } 40 | } 41 | 42 | class BouncingCanvasImagesStage extends BouncingCanvasParticlesStage { 43 | async initialize(benchmark, options) 44 | { 45 | await super.initialize(benchmark, options); 46 | const imageSrc = options["imageSrc"] || "../resources/yin-yang.svg"; 47 | this.imageElement = document.querySelector(".hidden[src=\"" + imageSrc + "\"]"); 48 | } 49 | 50 | createParticle() 51 | { 52 | return new BouncingCanvasImage(this); 53 | } 54 | } 55 | 56 | class BouncingCanvasImagesBenchmark extends Benchmark { 57 | constructor(options) 58 | { 59 | super(new BouncingCanvasImagesStage(), options); 60 | } 61 | } 62 | 63 | window.benchmarkClass = BouncingCanvasImagesBenchmark; 64 | -------------------------------------------------------------------------------- /MotionMark/tests/template/resources/template-css.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-0224 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class TemplateCssStage extends Stage { 27 | async initialize(benchmark, options) 28 | { 29 | await super.initialize(benchmark, options); 30 | // Do initialization here. 31 | } 32 | 33 | tune(count) 34 | { 35 | // If count is -ve, -count elements need to be removed form the 36 | // stage. If count is +ve, +count elements need to be added to 37 | // the stage. 38 | 39 | // Change objects in the stage. 40 | } 41 | 42 | animate(timeDelta) 43 | { 44 | // Animate the elements such that all of them are redrawn. You 45 | // may need to define your object so it keeps its animation data. 46 | // This object should encapsulate a corrosponding HTMLElement. 47 | // You may also define a method called animate() in this object 48 | // and just call this function here for all the elements. 49 | 50 | // Loop through all your objects and ask them to animate. 51 | } 52 | } 53 | 54 | class TemplateCssBenchmark extends Benchmark { 55 | constructor(options) 56 | { 57 | super(new TemplateCssStage(), options); 58 | } 59 | } 60 | 61 | window.benchmarkClass = TemplateCssBenchmark; 62 | -------------------------------------------------------------------------------- /MotionMark/tests/template/resources/template-svg.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class TemplateSvgStage extends Stage { 27 | async initialize(benchmark, options) 28 | { 29 | await super.initialize(benchmark, options); 30 | // Do initialization here. 31 | } 32 | 33 | tune(count) 34 | { 35 | // If count is -ve, -count elements need to be removed form the 36 | // stage. If count is +ve, +count elements need to be added to 37 | // the stage. 38 | 39 | // TODO: Change objects in the stage. 40 | } 41 | 42 | animate(timeDelta) 43 | { 44 | // Animate the elements such that all of them are redrawn. You 45 | // may need to define your object so it keeps its animation data. 46 | // This object should encapsulate a corrosponding SVGElement. 47 | // You may also define a method called animate() in this object 48 | // and just call this function here for all the elements. 49 | 50 | // TODO: Loop through all your objects and ask them to animate. 51 | } 52 | } 53 | 54 | class TemplateSvgBenchmark extends Benchmark { 55 | constructor(options) 56 | { 57 | super(new TemplateSvgStage(), options); 58 | } 59 | } 60 | 61 | window.benchmarkClass = TemplateSvgBenchmark; 62 | -------------------------------------------------------------------------------- /MotionMark/tests/simple/resources/simple-canvas.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2017 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class SimpleCanvasStage extends CanvasStage { 27 | tune(count) 28 | { 29 | if (count == 0) 30 | return; 31 | 32 | if (count < 0) { 33 | this.offsetIndex = Math.max(this.offsetIndex + count, 0); 34 | return; 35 | } 36 | 37 | this.offsetIndex = this.offsetIndex + count; 38 | if (this.offsetIndex > this.objects.length) { 39 | // For some tests, it may be easier to see how well the test is going 40 | // by limiting the range of coordinates in which new objects can reside 41 | var coordinateMaximumFactor = Math.min(this.objects.length, Math.min(this.size.x, this.size.y)) / Math.min(this.size.x, this.size.y); 42 | var newIndex = this.offsetIndex - this.objects.length; 43 | for (var i = 0; i < newIndex; ++i) 44 | this.objects.push(new this._canvasObject(this, coordinateMaximumFactor)); 45 | } 46 | } 47 | 48 | animate() 49 | { 50 | var context = this.context; 51 | context.clearRect(0, 0, this.size.x, this.size.y); 52 | for (var i = 0, length = this.offsetIndex; i < length; ++i) 53 | this.objects[i].draw(context); 54 | } 55 | 56 | complexity() 57 | { 58 | return this.offsetIndex; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /MotionMark/tests/core/multiply.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 66 | 67 | 68 |
69 |
70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/bouncing-css-shapes.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 46 | 47 | 48 |
49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/focus.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 63 | 64 | 65 |
66 |
focus
67 |
68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-css-images.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingCssImage extends BouncingParticle { 27 | constructor(stage) 28 | { 29 | super(stage); 30 | 31 | this.element = document.createElement("img"); 32 | this.element.style.width = this.size.x + "px"; 33 | this.element.style.height = this.size.y + "px"; 34 | this.element.setAttribute("src", stage.imageSrc); 35 | 36 | stage.element.appendChild(this.element); 37 | this._move(); 38 | } 39 | 40 | _move() 41 | { 42 | this.element.style.transform = "translate(" + this.position.x + "px," + this.position.y + "px) " + this.rotater.rotateZ(); 43 | } 44 | 45 | animate(timeDelta) 46 | { 47 | super.animate(timeDelta); 48 | this._move(); 49 | } 50 | } 51 | 52 | class BouncingCssImagesStage extends BouncingParticlesStage { 53 | async initialize(benchmark, options) 54 | { 55 | await super.initialize(benchmark, options); 56 | this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg"; 57 | } 58 | 59 | createParticle() 60 | { 61 | return new BouncingCssImage(this); 62 | } 63 | 64 | particleWillBeRemoved(particle) 65 | { 66 | particle.element.remove(); 67 | } 68 | } 69 | 70 | class BouncingCssImagesBenchmark extends Benchmark { 71 | constructor(options) 72 | { 73 | super(new BouncingCssImagesStage(), options); 74 | } 75 | } 76 | 77 | window.benchmarkClass = BouncingCssImagesBenchmark; 78 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/multiply.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 66 | 67 | 68 |
69 |
70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /MotionMark/tests/text/design-6.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class TextTemplateBenchmark extends TextBenchmark { 27 | constructor(options) 28 | { 29 | var dataset; 30 | switch (options["corpus"]) { 31 | case "latin": 32 | dataset = [ 33 | "σχέδιο", 34 | "umění", 35 | "design", 36 | "искусство", 37 | "conception", 38 | "diseño" 39 | ]; 40 | break; 41 | case "cjk": 42 | dataset = [ 43 | "设计", 44 | "디자인", 45 | "デザイン", 46 | "예술", 47 | "使吃惊", 48 | "がいねん", 49 | ]; 50 | break; 51 | case "arabic": 52 | dataset = [ 53 | {text: "تصميم", direction: "rtl"}, 54 | "வடிவமைப்பு", 55 | "योजना", 56 | {text: "לְעַצֵב", direction: "rtl"}, 57 | {text: "خلاق", direction: "rtl"}, 58 | "ศิลปะ", 59 | ]; 60 | break; 61 | } 62 | 63 | dataset.forEach(function(entry, i) { 64 | var td = document.getElementById("cell" + i); 65 | if (typeof entry === 'string') { 66 | td.innerText = entry; 67 | } else { 68 | td.innerText = entry.text; 69 | td.classList.add("rtl"); 70 | } 71 | }) 72 | 73 | super(options); 74 | } 75 | } 76 | 77 | window.benchmarkClass = TextTemplateBenchmark; 78 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/canvas-stage.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class CanvasStage extends Stage { 27 | constructor(canvasObject) 28 | { 29 | super(); 30 | this._canvasObject = canvasObject; 31 | this.objects = []; 32 | this.offsetIndex = 0; 33 | } 34 | 35 | async initialize(benchmark, options) 36 | { 37 | await super.initialize(benchmark, options); 38 | this.context = this.element.getContext("2d"); 39 | } 40 | 41 | tune(count) 42 | { 43 | if (count == 0) 44 | return; 45 | 46 | if (count < 0) { 47 | this.offsetIndex = Math.min(this.offsetIndex - count, this.objects.length); 48 | return; 49 | } 50 | 51 | var newIndex = this.offsetIndex - count; 52 | if (newIndex < 0) { 53 | this.offsetIndex = 0; 54 | newIndex = -newIndex; 55 | for (var i = 0; i < newIndex; ++i) { 56 | if (this._canvasObject.constructor === Array) 57 | this.objects.push(new (Stage.randomElementInArray(this._canvasObject))(this)); 58 | else 59 | this.objects.push(new this._canvasObject(this)); 60 | } 61 | } else 62 | this.offsetIndex = newIndex; 63 | } 64 | 65 | animate() 66 | { 67 | var context = this.context; 68 | context.clearRect(0, 0, this.size.x, this.size.y); 69 | for (var i = this.offsetIndex, length = this.objects.length; i < length; ++i) 70 | this.objects[i].draw(context); 71 | } 72 | 73 | complexity() 74 | { 75 | return this.objects.length - this.offsetIndex; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/resources/compositing-transforms.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingCompositedImage extends BouncingParticle { 27 | constructor(stage) 28 | { 29 | super(stage); 30 | 31 | this.element = document.createElement("img"); 32 | this.element.style.width = this.size.x + "px"; 33 | this.element.style.height = this.size.y + "px"; 34 | this.element.setAttribute("src", stage.imageSrc); 35 | 36 | if (stage.useFilters) 37 | this.element.style.filter = "hue-rotate(" + Stage.randomAngle() + "rad)"; 38 | 39 | stage.element.appendChild(this.element); 40 | this._move(); 41 | } 42 | 43 | _move() 44 | { 45 | this.element.style.transform = "translate3d(" + this.position.x + "px," + this.position.y + "px, 0) " + this.rotater.rotateZ(); 46 | } 47 | 48 | animate(timeDelta) 49 | { 50 | super.animate(timeDelta); 51 | this._move(); 52 | } 53 | } 54 | 55 | class CompositingTransformsStage extends BouncingParticlesStage { 56 | async initialize(benchmark, options) 57 | { 58 | await super.initialize(benchmark, options); 59 | this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg"; 60 | this.useFilters = options["filters"] == "yes"; 61 | } 62 | 63 | createParticle() 64 | { 65 | return new BouncingCompositedImage(this); 66 | } 67 | 68 | particleWillBeRemoved(particle) 69 | { 70 | particle.element.remove(); 71 | } 72 | } 73 | 74 | class CompositedTransformsBenchmark extends Benchmark { 75 | constructor(options) 76 | { 77 | super(new CompositingTransformsStage(), options); 78 | } 79 | } 80 | 81 | window.benchmarkClass = CompositedTransformsBenchmark; 82 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/contribute.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Governance.md: -------------------------------------------------------------------------------- 1 | # MotionMark Governance Policy 2 | 3 | MotionMark uses multistakeholder governance. This allows participating organizations to collaborate and 4 | develop the benchmark with the goal of maintaining and developing the benchmark to represent rendering- 5 | related workloads on the web. This also provides a structure that can endure to provide maintenance and 6 | adapt to the future web. 7 | 8 | An eligible “browser project” is a core end-to-end web browser engine with an integrated JavaScript engine 9 | which distributes implementations widely. The project may delegate decision making within MotionMark 10 | to multiple representatives (for example, to review code commits or to provide consensus for major changes). 11 | The participating browser projects at this time are [Blink](https://www.chromium.org/blink/), 12 | [Gecko](https://developer.mozilla.org/en-US/docs/Glossary/Gecko), and [WebKit](https://webkit.org). 13 | Additions to this list can be proposed via filing an issue in this GitHub repository, and additions to this 14 | list count as a Major change (described below). 15 | 16 | The intent is that the working team should be able to move quickly for most changes, 17 | with a higher level of process and consensus expected based on the impact of the change. The working team 18 | consists of the contributors to MotionMark, and their respective browser projects. 19 | 20 | - **Trivial change** - This is a change that has no effect on the official benchmark and includes changes 21 | to whitespaces, comments, documentation outside policies and governance model, and unofficial test cases. 22 | A trivial change requires approval by a reviewer, who is not the author of the change, 23 | from one of the participating browser projects. The current reviewership policies for the participating 24 | browser projects can be found 25 | [here](https://chromium.googlesource.com/chromium/src/+/master/docs/code_reviews.md), 26 | [here](https://wiki.mozilla.org/Firefox/Code_Review), and 27 | [here](https://webkit.org/commit-and-review-policy/). 28 | The intent is to ensure basic code quality & license compatibility, not to reach agreement. 29 | For example, one participating browser project might be both writing and reviewing a new benchmark in 30 | a subfolder to test in their own CI, or reviewing code written by an external contributor. 31 | - **Non-trivial change** - This is a change that has small impact on the official benchmark and includes 32 | changes to official test cases, test runners, bug fixes, and the appearance of the benchmark. 33 | A non-trivial change requires approval by at least two of the participating browser projects 34 | (including either authoring or reviewing the change) and none other strongly opposed to the change 35 | within 10 business days. 36 | - **Major change** - This is a change that has major implications on the official benchmark such as 37 | releasing of a new version of the benchmark or any revisions to governance policies and processes, 38 | including changes to the participating browser projects. 39 | A major change requires a consensus, meaning approvals by each of the participating browser projects. 40 | 41 | This governance policy and associated code will be hosted inside the MotionMark repository within 42 | the WebKit GitHub organization under the 2-clause BSD license. 43 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-svg-particles.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2017 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingSvgParticle extends BouncingParticle { 27 | constructor(stage, shape) 28 | { 29 | super(stage); 30 | this._shape = shape; 31 | } 32 | 33 | _applyClipping(stage) 34 | { 35 | if (stage.clip != "star") 36 | return; 37 | 38 | stage.ensureClipStarIsCreated(); 39 | this.element.setAttribute("clip-path", "url(#star-clip)"); 40 | } 41 | 42 | _move() 43 | { 44 | var transform = "translate(" + this.position.x + ", " + this.position.y + ")"; 45 | if (this._shape != "circle") 46 | transform += this.rotater.rotate(this.size.center); 47 | this.element.setAttribute("transform", transform); 48 | } 49 | 50 | animate(timeDelta) 51 | { 52 | super.animate(timeDelta); 53 | this._move(); 54 | } 55 | } 56 | 57 | class BouncingSvgParticlesStage extends BouncingParticlesStage { 58 | _createDefs() 59 | { 60 | return Utilities.createSVGElement("defs", {}, {}, this.element); 61 | } 62 | 63 | _ensureDefsIsCreated() 64 | { 65 | return this.element.querySelector("defs") || this._createDefs(); 66 | } 67 | 68 | _createClipStar() 69 | { 70 | var attrs = { id: "star-clip", clipPathUnits: "objectBoundingBox" }; 71 | var clipPath = Utilities.createSVGElement("clipPath", attrs, {}, this._ensureDefsIsCreated()); 72 | 73 | attrs = { d: "M.50,0L.38,.38L0,.38L.30,.60L.18,1L.50,.75L.82,1L.70,.60L1,.38L.62,.38z" }; 74 | Utilities.createSVGElement("path", attrs, {}, clipPath); 75 | return clipPath; 76 | } 77 | 78 | ensureClipStarIsCreated() 79 | { 80 | return this.element.querySelector("#star-clip") || this._createClipStar(); 81 | } 82 | 83 | particleWillBeRemoved(particle) 84 | { 85 | particle.element.remove(); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/resources/leaves.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class SimpleLeaf extends Leaf { 27 | static get sizeMinimum() { return 25; } 28 | static get sizeRange() { return 0; } 29 | static get usesOpacity() { return false; } 30 | 31 | constructor(stage) 32 | { 33 | super(stage); 34 | } 35 | 36 | move() 37 | { 38 | this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ(); 39 | } 40 | } 41 | 42 | class ScaleLeaf extends Leaf { 43 | static get sizeMinimum() { return 20; } 44 | static get sizeRange() { return 30; } 45 | static get usesOpacity() { return false; } 46 | 47 | constructor(stage) 48 | { 49 | super(stage); 50 | } 51 | 52 | move() 53 | { 54 | this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ(); 55 | } 56 | } 57 | 58 | class OpacityLeaf extends Leaf { 59 | static get sizeMinimum() { return 25; } 60 | static get sizeRange() { return 0; } 61 | static get usesOpacity() { return true; } 62 | 63 | constructor(stage) 64 | { 65 | super(stage); 66 | } 67 | 68 | move() 69 | { 70 | this.element.style.transform = "translate(" + this._position.x + "px, " + this._position.y + "px)" + this.rotater.rotateZ(); 71 | this.element.style.opacity = this._opacity; 72 | } 73 | } 74 | 75 | 76 | class LeavesDerivedBenchmark extends LeavesBenchmark { 77 | constructor(options) 78 | { 79 | switch (options["style"]) { 80 | case "simple": 81 | window.Leaf = SimpleLeaf; 82 | break; 83 | case "scale": 84 | window.Leaf = ScaleLeaf; 85 | break; 86 | case "opacity": 87 | window.Leaf = OpacityLeaf; 88 | break; 89 | } 90 | super(options); 91 | } 92 | } 93 | 94 | window.benchmarkClass = LeavesDerivedBenchmark; 95 | -------------------------------------------------------------------------------- /MotionMark/tests/3d/triangles-webgl.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | 36 | 37 | 38 | 75 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /MotionMark/tests/template/resources/template-canvas.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class TemplateCanvasObject 27 | { 28 | constructor(stage) 29 | { 30 | super(stage); 31 | } 32 | 33 | // For the canvas stage, most likely you will need to create your 34 | // animated object since it's only draw time thing. 35 | 36 | // Fill in your object data. 37 | 38 | _draw() 39 | { 40 | // Draw your object. 41 | } 42 | 43 | animate(timeDelta) 44 | { 45 | // Redraw the animated object. The last time this animated 46 | // item was drawn before 'timeDelta'. 47 | 48 | // Move your object. 49 | 50 | // Redraw your object. 51 | this._draw(); 52 | } 53 | } 54 | 55 | class TemplateCanvasStage extends Stage { 56 | async initialize(benchmark, options) 57 | { 58 | await super.initialize(benchmark, options); 59 | this.context = this.element.getContext("2d"); 60 | // Define a collection for your objects. 61 | // await any async work (e.g. image loading). 62 | } 63 | 64 | tune(count) 65 | { 66 | // If count is -ve, -count elements need to be removed form the 67 | // stage. If count is +ve, +count elements need to be added to 68 | // the stage. 69 | 70 | // Change objects in the stage. 71 | } 72 | 73 | animate(timeDelta) 74 | { 75 | // Animate the elements such that all of them are redrawn. Most 76 | // likely you will need to call TemplateCanvasObject.animate() 77 | // for all your animated objects here. 78 | 79 | // Most likely you will need to clear the canvas with every redraw. 80 | this.context.clearRect(0, 0, this.size.x, this.size.y); 81 | 82 | // Loop through all your objects and ask them to animate. 83 | } 84 | } 85 | 86 | class TemplateCanvasBenchmark extends Benchmark { 87 | constructor(options) 88 | { 89 | super(new TemplateCanvasStage(), options); 90 | } 91 | } 92 | 93 | window.benchmarkClass = TemplateCanvasBenchmark; 94 | -------------------------------------------------------------------------------- /MotionMark/tests/text/design.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class TextTemplateBenchmark extends TextBenchmark { 27 | constructor(options) 28 | { 29 | var dataset; 30 | switch (options["corpus"]) { 31 | case "latin": 32 | dataset = [ 33 | "σχέδιο", 34 | "umění", 35 | "suunnittelu", 36 | "design", 37 | "deseń", 38 | "искусство", 39 | "дизайн", 40 | "conception", 41 | "kunst", 42 | "konstruktion", 43 | "τέχνη", 44 | "diseño" 45 | ]; 46 | break; 47 | case "cjk": 48 | dataset = [ 49 | "设计", 50 | "디자인", 51 | "デザイン", 52 | "がいねん", 53 | "藝術", 54 | "养殖", 55 | "예술", 56 | "展開する", 57 | "발달", 58 | "技術", 59 | "驚き", 60 | "使吃惊", 61 | ]; 62 | break; 63 | case "arabic": 64 | dataset = [ 65 | {text: "تصميم", direction: "rtl"}, 66 | "வடிவமைப்பு", 67 | "योजना", 68 | {text: "לְעַצֵב", direction: "rtl"}, 69 | {text: "خلاق", direction: "rtl"}, 70 | "ศิลปะ", 71 | "कौशल", 72 | {text: "אָמָנוּת", direction: "rtl"}, 73 | "கலை", 74 | "ดีไซน์", 75 | "পরিকল্পনা", 76 | {text: "ډیزاین", direction: "rtl"}, 77 | ]; 78 | break; 79 | } 80 | 81 | dataset.forEach(function(entry, i) { 82 | var td = document.getElementById("cell" + i); 83 | if (typeof entry === 'string') { 84 | td.innerText = entry; 85 | } else { 86 | td.innerText = entry.text; 87 | td.classList.add("rtl"); 88 | } 89 | }) 90 | 91 | super(options); 92 | } 93 | } 94 | 95 | window.benchmarkClass = TextTemplateBenchmark; 96 | -------------------------------------------------------------------------------- /MotionMark/resources/strings.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2020 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | var Strings = { 26 | version: "development", 27 | text: { 28 | testName: "Test Name", 29 | score: "Score", 30 | title: "MotionMark %s", 31 | determininingFrameRate: "Detecting Frame Rate…", 32 | runBenchmark: "Run Benchmark", 33 | usingFrameRate: "Framerate %sfps", 34 | frameRateDetectionFailure: "Failed to determine framerate, using 60fps", 35 | non60FrameRate: "Framerate %sfps. If comparing browsers, be sure to set your display refresh rate to 60Hz." 36 | }, 37 | json: { 38 | version: "version", 39 | 40 | marks: "marks", 41 | samplingStartTimeOffset: "Start sampling", 42 | samplingEndTimeOffset: "End sampling", 43 | 44 | samples: "samples", 45 | dataFieldMap: "dataFieldMap", 46 | controller: "controller", 47 | frameType: "frameType", 48 | time: "time", 49 | complexity: "complexity", 50 | frameLength: "frameLength", 51 | smoothedFrameLength: "smoothedFrameLength", 52 | 53 | mutationFrameType: "m", 54 | animationFrameType: "a", 55 | 56 | result: "result", 57 | configuration: "configuration", 58 | score: "score", 59 | scoreLowerBound: "scoreLowerBound", 60 | scoreUpperBound: "scoreUpperBound", 61 | fps: "fps", 62 | bootstrap: "bootstrap", 63 | bootstrapIterations: "bootstrapIterations", 64 | measurements: { 65 | average: "average", 66 | concern: "concern", 67 | stdev: "stdev", 68 | percent: "percent" 69 | }, 70 | 71 | regressions: { 72 | startIndex: "startIndex", 73 | endIndex: "endIndex", 74 | segment1: "segment1", 75 | segment2: "segment2", 76 | profile: "profile" 77 | }, 78 | 79 | profiles: { 80 | slope: "slope", 81 | flat: "flat" 82 | }, 83 | 84 | results: { 85 | iterations: "iterationsResults", 86 | tests: "testsResults" 87 | } 88 | } 89 | }; 90 | -------------------------------------------------------------------------------- /MotionMark/tests/dom/resources/dom-particles.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class DOMParticle extends Particle { 27 | constructor(stage) 28 | { 29 | super(stage); 30 | } 31 | 32 | initialize() 33 | { 34 | super.initialize(); 35 | this.element = document.createElement("div"); 36 | this.stage.element.appendChild(this.element); 37 | } 38 | 39 | reset() 40 | { 41 | super.reset(); 42 | 43 | this.position = Stage.randomElementInArray(this.stage.emitLocation); 44 | 45 | var angle = Stage.randomInt(0, this.stage.emitSteps) / this.stage.emitSteps * Math.PI * 2 + Stage.dateCounterValue(100) * this.stage.emissionSpin; 46 | this.velocity = new Point(Math.sin(angle), Math.cos(angle)) 47 | .multiply(Stage.random(.5, 2.5)); 48 | 49 | this.element.style.width = this.size.x + "px"; 50 | this.element.style.height = this.size.y + "px"; 51 | this.stage.colorOffset = (this.stage.colorOffset + 1) % 360; 52 | this.element.style.backgroundColor = "hsl(" + this.stage.colorOffset + ", 70%, 45%)"; 53 | } 54 | 55 | move() 56 | { 57 | this.element.style.transform = "translate(" + this.position.x + "px, " + this.position.y + "px)" + this.rotater.rotateZ(); 58 | } 59 | } 60 | 61 | class DOMParticleStage extends ParticlesStage { 62 | async initialize(benchmark, options) 63 | { 64 | await super.initialize(benchmark, options); 65 | this.emissionSpin = Stage.random(0, 3); 66 | this.emitSteps = Stage.randomInt(4, 6); 67 | this.emitLocation = [ 68 | new Point(this.size.x * .25, this.size.y * .333), 69 | new Point(this.size.x * .5, this.size.y * .25), 70 | new Point(this.size.x * .75, this.size.y * .333) 71 | ]; 72 | this.colorOffset = Stage.randomInt(0, 359); 73 | } 74 | 75 | createParticle() 76 | { 77 | return new DOMParticle(this); 78 | } 79 | 80 | willRemoveParticle(particle) 81 | { 82 | particle.element.remove(); 83 | } 84 | } 85 | 86 | class DOMParticleBenchmark extends Benchmark { 87 | constructor(options) 88 | { 89 | super(new DOMParticleStage(), options); 90 | } 91 | } 92 | 93 | window.benchmarkClass = DOMParticleBenchmark; 94 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-tagged-images.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingTaggedImage extends BouncingParticle { 27 | constructor(stage) 28 | { 29 | super(stage); 30 | 31 | this.element = document.createElement("img"); 32 | this.element.style.width = this.size.x + "px"; 33 | this.element.style.height = this.size.y + "px"; 34 | this.element.setAttribute("src", Stage.randomElementInArray(stage.images).src); 35 | 36 | stage.element.appendChild(this.element); 37 | this._move(); 38 | } 39 | 40 | _move() 41 | { 42 | this.element.style.transform = "translate(" + this.position.x + "px," + this.position.y + "px) " + this.rotater.rotateZ(); 43 | } 44 | 45 | animate(timeDelta) 46 | { 47 | super.animate(timeDelta); 48 | this._move(); 49 | } 50 | } 51 | 52 | class BouncingTaggedImagesStage extends BouncingParticlesStage { 53 | static imageSrcs = [ 54 | "image1", 55 | "image2", 56 | "image3", 57 | "image4", 58 | "image5", 59 | ]; 60 | 61 | constructor() 62 | { 63 | super(); 64 | this.images = []; 65 | } 66 | 67 | async initialize(benchmark, options) 68 | { 69 | await super.initialize(benchmark, options); 70 | const loadingPromises = []; 71 | BouncingTaggedImagesStage.imageSrcs.forEach(imageSrc => { 72 | loadingPromises.push(this._loadImage("resources/" + imageSrc + ".jpg")); 73 | }); 74 | await Promise.all(loadingPromises); 75 | } 76 | 77 | _loadImage(src) 78 | { 79 | return new Promise(resolve => { 80 | const img = new Image; 81 | img.addEventListener('load', () => resolve(img)); 82 | img.src = src; 83 | this.images.push(img); 84 | }); 85 | } 86 | 87 | createParticle() 88 | { 89 | return new BouncingTaggedImage(this); 90 | } 91 | 92 | particleWillBeRemoved(particle) 93 | { 94 | particle.element.remove(); 95 | } 96 | } 97 | 98 | class BouncingTaggedImagesBenchmark extends Benchmark { 99 | constructor(options) 100 | { 101 | super(new BouncingTaggedImagesStage(), options); 102 | } 103 | } 104 | 105 | window.benchmarkClass = BouncingTaggedImagesBenchmark; 106 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-css-shapes.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingCssShape extends BouncingParticle { 27 | constructor(stage) 28 | { 29 | super(stage); 30 | 31 | this.element = this._createSpan(stage); 32 | 33 | switch (stage.fill) { 34 | case "solid": 35 | default: 36 | this.element.style.backgroundColor = Stage.randomColor(); 37 | break; 38 | 39 | case "gradient": 40 | this.element.style.background = "linear-gradient(" + Stage.randomColor() + ", " + Stage.randomColor() + ")"; 41 | break; 42 | } 43 | 44 | if (stage.blend) 45 | this.element.style.mixBlendMode = Stage.randomStyleMixBlendMode(); 46 | 47 | // Some browsers have not un-prefixed the css filter yet. 48 | if (stage.filter) 49 | Utilities.setElementPrefixedProperty(this.element, "filter", Stage.randomStyleFilter()); 50 | 51 | this._move(); 52 | } 53 | 54 | _createSpan(stage) 55 | { 56 | var span = document.createElement("span"); 57 | span.className = stage.shape + " " + stage.clip; 58 | span.style.width = this.size.x + "px"; 59 | span.style.height = this.size.y + "px"; 60 | stage.element.appendChild(span); 61 | return span; 62 | } 63 | 64 | _move() 65 | { 66 | this.element.style.transform = "translate(" + this.position.x + "px," + this.position.y + "px)" + this.rotater.rotateZ(); 67 | } 68 | 69 | animate(timeDelta) 70 | { 71 | super.animate(timeDelta); 72 | this.rotater.next(timeDelta); 73 | this._move(); 74 | } 75 | } 76 | 77 | class BouncingCssShapesStage extends BouncingParticlesStage { 78 | async initialize(benchmark, options) 79 | { 80 | await super.initialize(benchmark, options); 81 | this.parseShapeParameters(options); 82 | } 83 | 84 | createParticle() 85 | { 86 | return new BouncingCssShape(this); 87 | } 88 | 89 | particleWillBeRemoved(particle) 90 | { 91 | particle.element.remove(); 92 | } 93 | } 94 | 95 | class BouncingCssShapesBenchmark extends Benchmark { 96 | constructor(options) 97 | { 98 | super(new BouncingCssShapesStage(), options); 99 | } 100 | } 101 | 102 | window.benchmarkClass = BouncingCssShapesBenchmark; 103 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-canvas-shapes.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingCanvasShape extends BouncingCanvasParticle { 27 | constructor(stage) 28 | { 29 | super(stage, stage.shape); 30 | this._fill = stage.fill; 31 | this._color0 = Stage.randomColor(); 32 | this._color1 = Stage.randomColor(); 33 | } 34 | 35 | _applyFill() 36 | { 37 | switch (this._fill) { 38 | case "gradient": 39 | var gradient = this.context.createLinearGradient(0, 0, this.size.width, 0); 40 | gradient.addColorStop(0, this._color0); 41 | gradient.addColorStop(1, this._color1); 42 | this.context.fillStyle = gradient; 43 | break; 44 | 45 | case "solid": 46 | default: 47 | this.context.fillStyle = this._color0; 48 | break; 49 | } 50 | } 51 | 52 | _drawShape() 53 | { 54 | this.context.beginPath(); 55 | 56 | switch (this._shape) { 57 | case "rect": 58 | this.context.rect(0, 0, this.size.width, this.size.height); 59 | break; 60 | 61 | case "circle": 62 | default: 63 | var center = this.size.center; 64 | var radius = Math.min(this.size.x, this.size.y) / 2; 65 | this.context.arc(center.x, center.y, radius, 0, Math.PI * 2, true); 66 | break; 67 | } 68 | 69 | this.context.fill(); 70 | } 71 | 72 | _draw() 73 | { 74 | this.context.save(); 75 | this._applyFill(); 76 | this.applyRotation(); 77 | this.applyClipping(); 78 | this._drawShape(); 79 | this.context.restore(); 80 | } 81 | } 82 | 83 | class BouncingCanvasShapesStage extends BouncingCanvasParticlesStage { 84 | constructor () 85 | { 86 | super(); 87 | } 88 | 89 | async initialize(benchmark, options) 90 | { 91 | await super.initialize(benchmark, options); 92 | this.parseShapeParameters(options); 93 | } 94 | 95 | createParticle() 96 | { 97 | return new BouncingCanvasShape(this); 98 | } 99 | } 100 | 101 | class BouncingCanvasShapesBenchmark extends Benchmark { 102 | constructor(options) 103 | { 104 | super(new BouncingCanvasShapesStage(), options); 105 | } 106 | } 107 | 108 | window.benchmarkClass = BouncingCanvasShapesBenchmark; 109 | -------------------------------------------------------------------------------- /MotionMark/tests/core/design.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 70 | 71 | 72 |
73 |
74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 |
σχέδιο设计suunnittelu
designдизайнتصميم
디자인conceptionデザイン
konstruktionעיצובdiseño
98 |
99 |
100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-canvas-particles.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2017 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingCanvasParticle extends BouncingParticle { 27 | static clips; 28 | constructor(stage, shape) 29 | { 30 | BouncingCanvasParticle.clips = { 31 | star: [ 32 | new Point(0.50, 0.00), 33 | new Point(0.38, 0.38), 34 | new Point(0.00, 0.38), 35 | new Point(0.30, 0.60), 36 | new Point(0.18, 1.00), 37 | new Point(0.50, 0.75), 38 | new Point(0.82, 1.00), 39 | new Point(0.70, 0.60), 40 | new Point(1.00, 0.38), 41 | new Point(0.62, 0.38) 42 | ] 43 | }; 44 | 45 | super(stage); 46 | this.context = stage.context; 47 | this._shape = shape; 48 | this._clip = stage.clip; 49 | } 50 | 51 | applyRotation() 52 | { 53 | if (this._shape == "circle") 54 | return; 55 | 56 | this.context.translate(this.size.x / 2, this.size.y / 2); 57 | this.context.rotate(this.rotater.degree() * Math.PI / 180); 58 | this.context.translate(-this.size.x / 2, -this.size.y / 2); 59 | } 60 | 61 | applyClipping() 62 | { 63 | var clipPoints = BouncingCanvasParticle.clips[this._clip]; 64 | if (!clipPoints) 65 | return; 66 | 67 | this.context.beginPath(); 68 | clipPoints.forEach(function(point, index) { 69 | var point = this.size.multiply(point); 70 | if (!index) 71 | this.context.moveTo(point.x, point.y); 72 | else 73 | this.context.lineTo(point.x, point.y); 74 | }, this); 75 | 76 | this.context.closePath(); 77 | this.context.clip(); 78 | } 79 | 80 | _draw() 81 | { 82 | throw "Not implemented"; 83 | } 84 | 85 | animate(timeDelta) 86 | { 87 | super.animate(timeDelta); 88 | this.context.save(); 89 | this.context.translate(this.position.x, this.position.y); 90 | this._draw(); 91 | this.context.restore(); 92 | } 93 | } 94 | 95 | class BouncingCanvasParticlesStage extends BouncingParticlesStage { 96 | async initialize(benchmark, options) 97 | { 98 | await super.initialize(benchmark, options); 99 | this.context = this.element.getContext("2d"); 100 | } 101 | 102 | animate(timeDelta) 103 | { 104 | this.context.clearRect(0, 0, this.size.x, this.size.y); 105 | this.particles.forEach(function(particle) { 106 | particle.animate(timeDelta); 107 | }); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /MotionMark/tests/core/suits.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /MotionMark/tests/text/design.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 69 | 70 | 71 |
72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 |
97 |
98 |
99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /MotionMark/tests/svg/suits.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /MotionMark/tests/bouncing-particles/resources/bouncing-svg-shapes.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class BouncingSvgShape extends BouncingSvgParticle { 27 | constructor(stage) 28 | { 29 | super(stage, stage.shape); 30 | this._fill = stage.fill; 31 | 32 | this._createShape(stage); 33 | this._applyClipping(stage); 34 | this._applyFill(stage); 35 | 36 | this._move(); 37 | } 38 | 39 | _createShape(stage) 40 | { 41 | switch (this._shape) { 42 | case "rect": 43 | var attrs = { x: 0, y: 0, width: this.size.x, height: this.size.y }; 44 | this.element = Utilities.createSVGElement("rect", attrs, {}, stage.element); 45 | break; 46 | 47 | case "circle": 48 | default: 49 | var attrs = { cx: this.size.x / 2, cy: this.size.y / 2, r: Math.min(this.size.x, this.size.y) / 2 }; 50 | this.element = Utilities.createSVGElement("circle", attrs, {}, stage.element); 51 | break; 52 | } 53 | } 54 | 55 | _applyFill(stage) 56 | { 57 | switch (this._fill) { 58 | case "gradient": 59 | var gradient = stage.createGradient(2); 60 | this.element.setAttribute("fill", "url(#" + gradient.getAttribute("id") + ")"); 61 | break; 62 | 63 | case "solid": 64 | default: 65 | this.element.setAttribute("fill", Stage.randomColor()); 66 | break; 67 | } 68 | } 69 | } 70 | 71 | class BouncingSvgShapesStage extends BouncingSvgParticlesStage { 72 | async initialize(benchmark, options) 73 | { 74 | await super.initialize(benchmark, options); 75 | this.parseShapeParameters(options); 76 | this._gradientsCount = 0; 77 | } 78 | 79 | createGradient(stops) 80 | { 81 | var attrs = { id: "gradient-" + ++this._gradientsCount }; 82 | var gradient = Utilities.createSVGElement("linearGradient", attrs, {}, this._ensureDefsIsCreated()); 83 | 84 | for (var i = 0; i < stops; ++i) { 85 | attrs = { offset: i * 100 / (stops - 1) + "%", 'stop-color': Stage.randomColor() }; 86 | Utilities.createSVGElement("stop", attrs, {}, gradient); 87 | } 88 | 89 | return gradient; 90 | } 91 | 92 | createParticle() 93 | { 94 | return new BouncingSvgShape(this); 95 | } 96 | 97 | particleWillBeRemoved(particle) 98 | { 99 | super.particleWillBeRemoved(particle); 100 | 101 | var fill = particle.element.getAttribute("fill"); 102 | if (fill.indexOf("url(#") != 0) 103 | return; 104 | 105 | var gradient = this.element.querySelector(fill.substring(4, fill.length - 1)); 106 | this._ensureDefsIsCreated().removeChild(gradient); 107 | } 108 | } 109 | 110 | class BouncingSvgShapesBenchmark extends Benchmark { 111 | constructor(options) 112 | { 113 | super(new BouncingSvgShapesStage(), options); 114 | } 115 | } 116 | 117 | window.benchmarkClass = BouncingSvgShapesBenchmark; 118 | -------------------------------------------------------------------------------- /MotionMark/tests/text/design-6.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 69 | 70 | 71 |
72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 |
107 |
108 |
109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /MotionMark/tests/svg/suits.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class ClipSuit extends SuitsParticle { 27 | static get hasGradient() { return false; } 28 | 29 | constructor(stage) 30 | { 31 | this.isClipPath = true; 32 | this.initialize(stage); 33 | } 34 | 35 | move() 36 | { 37 | this.element.setAttribute("transform", "translate(" + (this.position.x - this.size.center.x) + "," + (this.position.y - this.size.center.x) + ")"); 38 | } 39 | } 40 | 41 | class ShapeSuit extends SuitsParticle { 42 | static get hasGradient() { return false; } 43 | 44 | constructor(stage) 45 | { 46 | this.isClipPath = false; 47 | this.initialize(stage); 48 | } 49 | 50 | move() 51 | { 52 | this.element.setAttribute("transform", "translate(" + this.position.x + "," + this.position.y + ") " + this.transformSuffix); 53 | } 54 | } 55 | 56 | class RotationSuit extends SuitsParticle { 57 | static get hasGradient() { return false; } 58 | 59 | constructor(stage) 60 | { 61 | this.isClipPath = stage.particleCounter % 2; 62 | this.initialize(stage); 63 | } 64 | } 65 | 66 | class GradientSuit extends SuitsParticle { 67 | static get hasGradient() { return true; } 68 | 69 | constructor(stage) 70 | { 71 | this.isClipPath = stage.particleCounter % 2; 72 | this.initialize(stage); 73 | } 74 | 75 | move() 76 | { 77 | this.element.setAttribute("transform", "translate(" + this.position.x + "," + this.position.y + ") " + this.transformSuffix); 78 | } 79 | } 80 | 81 | class StaticSuit extends SuitsParticle { 82 | static get hasGradient() { return true; } 83 | 84 | constructor(stage) 85 | { 86 | this.isClipPath = stage.particleCounter % 2; 87 | this.initialize(stage); 88 | } 89 | 90 | reset() 91 | { 92 | super.reset(); 93 | this.originalPosition = Stage.randomPosition(this.stage.size); 94 | this.transformSuffix = " rotate(" + Math.floor(Stage.randomAngle() * 180 / Math.PI) + ",0,0)" + this.transformSuffix; 95 | } 96 | 97 | move() 98 | { 99 | this.element.setAttribute("transform", "translate(" + this.originalPosition.x + "," + this.originalPosition.y + ") " + this.transformSuffix); 100 | } 101 | } 102 | 103 | 104 | class SuitsDerivedBenchmark extends SuitsBenchmark { 105 | constructor(options) 106 | { 107 | switch (options["style"]) { 108 | case "clip": 109 | window.SuitsParticle = ClipSuit; 110 | break; 111 | case "shape": 112 | window.SuitsParticle = ShapeSuit; 113 | break; 114 | case "rotation": 115 | window.SuitsParticle = RotationSuit; 116 | break; 117 | case "gradient": 118 | window.SuitsParticle = GradientSuit; 119 | break; 120 | case "static": 121 | window.SuitsParticle = StaticSuit; 122 | break; 123 | } 124 | super(options); 125 | } 126 | } 127 | 128 | window.benchmarkClass = SuitsDerivedBenchmark; 129 | -------------------------------------------------------------------------------- /MotionMark/index.html: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | MotionMark 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 51 | 52 | 53 |
54 |
55 | 59 |
60 |

MotionMark is a graphics benchmark that measures a browser’s capability to animate complex scenes at a target frame rate.

61 | 62 |

More details about the benchmark are available. Bigger scores are better.

63 |

For accurate results, please take your browser window full screen, or rotate your device to landscape orientation.

64 |

Please rotate your device.

65 | 66 |

 

67 |
68 |
69 | 70 |
71 | 72 |
73 | 77 |
78 |
79 |
80 |
81 |
82 | on a small screen (phone) 83 | on a medium screen (laptop, tablet) 84 | on a large screen (desktop) 85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | 95 |
96 |
97 |
98 | 99 | 100 | -------------------------------------------------------------------------------- /MotionMark/tests/simple/resources/tiled-canvas-image.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class CanvasImageTile { 27 | constructor(stage, source) 28 | { 29 | this._context = stage.context; 30 | this._size = stage.tileSize; 31 | this.source = source; 32 | } 33 | 34 | getImageData() 35 | { 36 | this._imagedata = this._context.getImageData(this.source.x, this.source.y, this._size.width, this._size.height); 37 | } 38 | 39 | putImageData(destination) 40 | { 41 | this._context.putImageData(this._imagedata, destination.x, destination.y); 42 | } 43 | } 44 | 45 | class TiledCanvasImageStage extends Stage { 46 | constructor(element, options) 47 | { 48 | super(); 49 | } 50 | 51 | async initialize(benchmark, options) 52 | { 53 | await super.initialize(benchmark, options); 54 | this.context = this.element.getContext("2d"); 55 | this._setupTiles(); 56 | } 57 | 58 | _setupTiles() 59 | { 60 | const maxTilesPerRow = 50; 61 | const maxTilesPerCol = 50; 62 | 63 | this.tileSize = this.size.multiply(new Point(1 / maxTilesPerRow, 1 / maxTilesPerCol)); 64 | 65 | this._tiles = new Array(maxTilesPerRow * maxTilesPerCol); 66 | 67 | var source = Point.zero; 68 | for (var index = 0; index < this._tiles.length; ++index) { 69 | this._tiles[index] = new CanvasImageTile(this, source); 70 | source = this._nextTilePosition(source); 71 | } 72 | 73 | this._ctiles = 0; 74 | } 75 | 76 | _nextTilePosition(destination) 77 | { 78 | var next = destination.add(this.tileSize); 79 | 80 | if (next.x >= this._size.width) 81 | return new Point(0, next.y >= this._size.height ? 0 : next.y); 82 | 83 | return new Point(next.x, destination.y); 84 | } 85 | 86 | tune(count) 87 | { 88 | this._ctiles += count; 89 | 90 | this._ctiles = Math.max(this._ctiles, 0); 91 | this._ctiles = Math.min(this._ctiles, this._tiles.length); 92 | } 93 | 94 | _drawBackground() 95 | { 96 | var size = this._benchmark._stage.size; 97 | var gradient = this.context.createLinearGradient(0, 0, size.width, 0); 98 | gradient.addColorStop(0, "red"); 99 | gradient.addColorStop(1, "white"); 100 | this.context.save(); 101 | this.context.fillStyle = gradient; 102 | this.context.fillRect(0, 0, size.width, size.height); 103 | this.context.restore(); 104 | } 105 | 106 | animate(timeDelta) 107 | { 108 | this._drawBackground(); 109 | 110 | if (!this._ctiles) 111 | return; 112 | 113 | this._tiles.shuffle(); 114 | 115 | var destinations = new Array(this._ctiles); 116 | for (var index = 0; index < this._ctiles; ++index) { 117 | this._tiles[index].getImageData(); 118 | destinations[index] = this._tiles[index].source; 119 | } 120 | 121 | destinations.shuffle(); 122 | 123 | for (var index = 0; index < this._ctiles; ++index) 124 | this._tiles[index].putImageData(destinations[index]); 125 | } 126 | 127 | complexity() 128 | { 129 | return this._ctiles; 130 | } 131 | } 132 | 133 | class TiledCanvasImageBenchmark extends Benchmark { 134 | constructor(options) 135 | { 136 | super(new TiledCanvasImageStage(), options); 137 | } 138 | } 139 | 140 | window.benchmarkClass = TiledCanvasImageBenchmark; 141 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/particles.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class Particle { 27 | static get sizeMinimum() { return 40; } 28 | static get sizeRange() { return 10; } 29 | 30 | constructor(stage) 31 | { 32 | this.stage = stage; 33 | this.rotater = Stage.randomRotater(); 34 | this.initialize(); 35 | this.reset(); 36 | this.move(); 37 | } 38 | 39 | initialize() 40 | { 41 | } 42 | 43 | reset() 44 | { 45 | var randSize = Math.round(Math.pow(Pseudo.random(), 4) * this.constructor.sizeRange + this.constructor.sizeMinimum); 46 | this.size = new Point(randSize, randSize); 47 | this.minPosition = this.size.center; 48 | this.maxPosition = this.stage.size.subtract(this.minPosition); 49 | } 50 | 51 | animate(timeDelta) 52 | { 53 | this.rotater.next(timeDelta); 54 | 55 | this.position = this.position.add(this.velocity.multiply(timeDelta)); 56 | this.velocity.y += 0.03; 57 | 58 | // If particle is going to move off right side 59 | if (this.position.x > this.maxPosition.x) { 60 | if (this.velocity.x > 0) 61 | this.velocity.x *= -1; 62 | this.position.x = this.maxPosition.x; 63 | } else if (this.position.x < this.minPosition.x) { 64 | // If particle is going to move off left side 65 | if (this.velocity.x < 0) 66 | this.velocity.x *= -1; 67 | this.position.x = this.minPosition.x; 68 | } 69 | 70 | // If particle is going to move off bottom side 71 | if (this.position.y > this.maxPosition.y) { 72 | // Adjust direction but maintain magnitude 73 | var magnitude = this.velocity.length(); 74 | this.velocity.x *= 1.5 + .005 * this.size.x; 75 | this.velocity = this.velocity.normalize().multiply(magnitude); 76 | if (Math.abs(this.velocity.y) < 0.7) 77 | this.reset(); 78 | else { 79 | if (this.velocity.y > 0) 80 | this.velocity.y *= -0.999; 81 | this.position.y = this.maxPosition.y; 82 | } 83 | } else if (this.position.y < this.minPosition.y) { 84 | // If particle is going to move off top side 85 | var magnitude = this.velocity.length(); 86 | this.velocity.x *= 1.5 + .005 * this.size.x; 87 | this.velocity = this.velocity.normalize().multiply(magnitude); 88 | if (this.velocity.y < 0) 89 | this.velocity.y *= -0.998; 90 | this.position.y = this.minPosition.y; 91 | } 92 | 93 | this.move(); 94 | } 95 | 96 | move() 97 | { 98 | } 99 | } 100 | 101 | class ParticlesStage extends Stage { 102 | constructor() 103 | { 104 | super(); 105 | this.particles = []; 106 | } 107 | 108 | animate(timeDelta) 109 | { 110 | timeDelta /= 4; 111 | this.particles.forEach(function(particle) { 112 | particle.animate(timeDelta); 113 | }); 114 | } 115 | 116 | tune(count) 117 | { 118 | if (count == 0) 119 | return; 120 | 121 | if (count > 0) { 122 | for (var i = 0; i < count; ++i) 123 | this.particles.push(this.createParticle()); 124 | return; 125 | } 126 | 127 | count = Math.min(-count, this.particles.length); 128 | 129 | if (typeof(this.willRemoveParticle) == "function") { 130 | for (var i = 0; i < count; ++i) 131 | this.willRemoveParticle(this.particles[i]); 132 | } 133 | 134 | this.particles.splice(0, count); 135 | } 136 | 137 | complexity() 138 | { 139 | return this.particles.length; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /MotionMark/tests/resources/benchmark.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2025 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | class Benchmark { 27 | constructor(stage, options) 28 | { 29 | this._animateLoop = this._animateLoop.bind(this); 30 | this._warmupLength = options["warmup-length"]; 31 | this._frameCount = 0; 32 | this._warmupFrameCount = options["warmup-frame-count"]; 33 | this._firstFrameMinimumLength = options["first-frame-minimum-length"]; 34 | 35 | this._stage = stage; 36 | 37 | switch (options["time-measurement"]) 38 | { 39 | case "performance": 40 | if (window.performance && window.performance.now) 41 | this._getTimestamp = performance.now.bind(performance); 42 | else 43 | this._getTimestamp = null; 44 | break; 45 | case "raf": 46 | this._getTimestamp = null; 47 | break; 48 | case "date": 49 | this._getTimestamp = Date.now; 50 | break; 51 | } 52 | 53 | options["test-interval"] *= 1000; 54 | switch (options["controller"]) 55 | { 56 | case "fixed": 57 | this._controller = new FixedController(this, options); 58 | break; 59 | case "adaptive": 60 | this._controller = new AdaptiveController(this, options); 61 | break; 62 | case "ramp": 63 | this._controller = new RampController(this, options); 64 | break; 65 | } 66 | } 67 | 68 | // Subclasses should override this if they have setup to do prior to commencing. 69 | async initialize(options) 70 | { 71 | await this._stage.initialize(this, options); 72 | } 73 | 74 | get stage() 75 | { 76 | return this._stage; 77 | } 78 | 79 | get timestamp() 80 | { 81 | return this._currentTimestamp - this._benchmarkStartTimestamp; 82 | } 83 | 84 | backgroundColor() 85 | { 86 | var stage = window.getComputedStyle(document.getElementById("stage")); 87 | return stage["background-color"]; 88 | } 89 | 90 | run() 91 | { 92 | return new Promise(resolve => { 93 | this._completionFunction = resolve; 94 | this._previousTimestamp = undefined; 95 | this._didWarmUp = false; 96 | this._stage.tune(this._controller.initialComplexity - this._stage.complexity()); 97 | this._animateLoop(); 98 | }); 99 | } 100 | 101 | _animateLoop(timestamp) 102 | { 103 | timestamp = (this._getTimestamp && this._getTimestamp()) || timestamp; 104 | this._currentTimestamp = timestamp; 105 | 106 | if (this._controller.shouldStop(timestamp)) { 107 | this._completionFunction(this._controller.results()); 108 | return; 109 | } 110 | 111 | if (!this._didWarmUp) { 112 | if (!this._previousTimestamp) { 113 | this._previousTimestamp = timestamp; 114 | this._benchmarkStartTimestamp = timestamp; 115 | } else if (timestamp - this._previousTimestamp >= this._warmupLength && this._frameCount >= this._warmupFrameCount) { 116 | this._didWarmUp = true; 117 | this._benchmarkStartTimestamp = timestamp; 118 | this._controller.start(timestamp, this._stage); 119 | this._previousTimestamp = timestamp; 120 | 121 | while (this._getTimestamp && this._getTimestamp() - timestamp < this._firstFrameMinimumLength) { 122 | } 123 | } 124 | 125 | this._stage.animate(0); 126 | ++this._frameCount; 127 | requestAnimationFrame(this._animateLoop); 128 | return; 129 | } 130 | 131 | this._controller.update(timestamp, this._stage); 132 | this._stage.animate(timestamp - this._previousTimestamp); 133 | this._previousTimestamp = timestamp; 134 | requestAnimationFrame(this._animateLoop); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /MotionMark/tests/core/resources/focus.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-2024 Apple Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 | * THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | var minimumDiameter = 30; 27 | var sizeVariance = 20; 28 | var travelDistance = 50; 29 | 30 | var minBlurValue = 1; 31 | var maxBlurValue = 10; 32 | 33 | var opacityMultiplier = 30; 34 | var focusDuration = 1000; 35 | var movementDuration = 2500; 36 | 37 | class FocusElement { 38 | constructor(stage) 39 | { 40 | super(stage); 41 | 42 | var size = minimumDiameter + sizeVariance; 43 | 44 | // Size and blurring are a function of depth. 45 | this._depth = Pseudo.random(); 46 | var distance = Utilities.lerp(this._depth, 0, sizeVariance); 47 | size -= distance; 48 | 49 | var top = Stage.random(0, stage.size.height - size); 50 | var left = Stage.random(0, stage.size.width - size); 51 | 52 | this.particle = document.createElement("div"); 53 | this.particle.style.width = size + "px"; 54 | this.particle.style.height = size + "px"; 55 | this.particle.style.top = top + "px"; 56 | this.particle.style.left = left + "px"; 57 | this.particle.style.zIndex = Math.round((1 - this._depth) * 10); 58 | 59 | var depthMultiplier = Utilities.lerp(1 - this._depth, 0.8, 1); 60 | this._sinMultiplier = Pseudo.random() * Stage.randomSign() * depthMultiplier * travelDistance; 61 | this._cosMultiplier = Pseudo.random() * Stage.randomSign() * depthMultiplier * travelDistance; 62 | 63 | this.animate(stage, 0, 0); 64 | } 65 | 66 | hide() 67 | { 68 | this.particle.style.display = "none"; 69 | } 70 | 71 | show() 72 | { 73 | this.particle.style.display = "block"; 74 | } 75 | 76 | animate(stage, sinFactor, cosFactor) 77 | { 78 | var top = sinFactor * this._sinMultiplier; 79 | var left = cosFactor * this._cosMultiplier; 80 | var distance = Math.abs(this._depth - stage.focalPoint); 81 | var blur = Utilities.lerp(distance, minBlurValue, maxBlurValue); 82 | var opacity = Math.max(5, opacityMultiplier * (1 - distance)); 83 | 84 | Utilities.setElementPrefixedProperty(this.particle, "filter", "blur(" + blur + "px) opacity(" + opacity + "%)"); 85 | this.particle.style.transform = "translate3d(" + left + "%, " + top + "%, 0)"; 86 | } 87 | } 88 | 89 | class FocusStage extends Stage { 90 | async initialize(benchmark, options) 91 | { 92 | await super.initialize(benchmark, options); 93 | this._testElements = []; 94 | this._offsetIndex = 0; 95 | this.focalPoint = 0.5; 96 | } 97 | 98 | complexity() 99 | { 100 | return this._offsetIndex; 101 | } 102 | 103 | tune(count) 104 | { 105 | if (count == 0) 106 | return; 107 | 108 | if (count < 0) { 109 | this._offsetIndex = Math.max(0, this._offsetIndex + count); 110 | for (var i = this._offsetIndex; i < this._testElements.length; ++i) 111 | this._testElements[i].hide(); 112 | return; 113 | } 114 | 115 | var newIndex = this._offsetIndex + count; 116 | for (var i = this._testElements.length; i < newIndex; ++i) { 117 | var obj = new FocusElement(this); 118 | this._testElements.push(obj); 119 | this.element.appendChild(obj.particle); 120 | } 121 | for (var i = this._offsetIndex; i < newIndex; ++i) 122 | this._testElements[i].show(); 123 | this._offsetIndex = newIndex; 124 | } 125 | 126 | animate() 127 | { 128 | var time = this._benchmark.timestamp; 129 | var sinFactor = Math.sin(time / movementDuration); 130 | var cosFactor = Math.cos(time / movementDuration); 131 | 132 | this.focalPoint = 0.5 + 0.5 * Math.sin(time / focusDuration); 133 | 134 | for (var i = 0; i < this._offsetIndex; ++i) 135 | this._testElements[i].animate(this, sinFactor, cosFactor); 136 | } 137 | } 138 | 139 | class FocusBenchmark extends Benchmark { 140 | constructor(options) 141 | { 142 | super(new FocusStage(), options); 143 | } 144 | } 145 | 146 | window.benchmarkClass = FocusBenchmark; 147 | --------------------------------------------------------------------------------