⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 185780 in webkit


Ignore:
Timestamp:
Jun 19, 2015, 4:49:38 PM (11 years ago)
Author:
fpizlo@apple.com
Message:

JetStream should include a JavaScript version of the CDx real-time benchmark
https://bugs.webkit.org/show_bug.cgi?id=146156

Reviewed by Geoffrey Garen.

This adds a JavaScript port of the CDx real-time benchmark to JetStream, and retires
the cordic test because it was previously the smallest and probably least interesting.

The new test, "cdjs", is mostly a faithful rewrite of the Java code into JavaScript.
I got the Java code from https://www.cs.purdue.edu/sss/projects/cdx/.

There are some differences:

  • It uses RedBlackTree's for all sets and maps rather than hashtables. This is clearly more in the spirit of real-time than the CDx benchmark. FWIW, CDx used to use trees and I don't know why that changed in the latest version.


  • CDjs doesn't attempt to avoid memory allocations, unlike the real-time Java version. I wrote the code that I wanted to write for aesthetics, rather than the code that I would have written if I tried to write the fastest code possible. Again, I believe that this is in the spirit of CDj - it's meant to test what would happen if you wrote real-timey stuff in a high level language and actually took advantage of that language to be more productive.


The test score reflects the average latency of the worst 10 samples out of 200 samples.
The simulation uses 1000 aircraft, flying along paths that result in some detected
collisions every once in a while. The benchmark validates its results by checking the
total number of collisions detected.

Apart from the integration into the JetStream harness, the CDjs directory contains a
fully self-contained benchmark that could be run either in the jsc shell or in browser.

This new code uses the same 3-clause BSD license as the Purdue code, and gives
attribution to Purdue in almost all files. I believe that is appropriate since I wrote
most of the JS files by looking at the Purdue Java code and trascribing to JavaScript.
In some cases, I even copy-pasted the Java code, like the complicated math for
four-dimensional intersections and voxel hashing.

  • JetStream/CDjsSetup.js: Added.
  • JetStream/Octane2Setup.js:
  • JetStream/Reference.js:
  • JetStream/cdjs: Added.
  • JetStream/cdjs/benchmark.js: Added.

(benchmark):

  • JetStream/cdjs/call_sign.js: Added.

(CallSign):
(CallSign.prototype.compareTo):
(CallSign.prototype.toString):

  • JetStream/cdjs/collision.js: Added.

(Collision):
(Collision.prototype.toString):

  • JetStream/cdjs/collision_detector.js: Added.

(CollisionDetector):
(CollisionDetector.prototype.handleNewFrame.get for):
(CollisionDetector.prototype.handleNewFrame):

  • JetStream/cdjs/constants.js: Added.
  • JetStream/cdjs/main.html: Added.
  • JetStream/cdjs/main.js: Added.
  • JetStream/cdjs/motion.js: Added.

(Motion):
(Motion.prototype.toString):
(Motion.prototype.delta):
(Motion.prototype.findIntersection):

  • JetStream/cdjs/motion_test.js: Added.

(checkDoesIntersect):
(checkDoesNotIntersect):
(makeMotion):

  • JetStream/cdjs/red_black_tree.js: Added.

(RedBlackTree):
(RedBlackTree.):

  • JetStream/cdjs/red_black_tree_test.js: Added.

(test):
(test.):

  • JetStream/cdjs/reduce_collision_set.js: Added.

(drawMotionOnVoxelMap):
(drawMotionOnVoxelMap.):
(.get reduceCollisionSet):

  • JetStream/cdjs/reduce_collision_set_test.js: Added.

(makeMotion):
(keys):
(test):

  • JetStream/cdjs/simulator.js: Added.

(Simulator):
(Simulator.prototype.simulate):

  • JetStream/cdjs/util.js: Added.

(compareNumbers):
(averageAbovePercentile):
(currentTime):
(else.currentTime):

  • JetStream/cdjs/vector_2d.js: Added.

(Vector2D):
(Vector2D.prototype.plus):
(Vector2D.prototype.minus):
(Vector2D.prototype.toString):
(Vector2D.prototype.compareTo):

  • JetStream/cdjs/vector_3d.js: Added.

(Vector3D):
(Vector3D.prototype.plus):
(Vector3D.prototype.minus):
(Vector3D.prototype.dot):
(Vector3D.prototype.squaredMagnitude):
(Vector3D.prototype.magnitude):
(Vector3D.prototype.times):
(Vector3D.prototype.as2D):
(Vector3D.prototype.toString):

  • JetStream/create.rb:
  • JetStream/index-TEMPLATE.html:
  • JetStream/sunspider/cordic.js: Removed.
Location:
trunk/PerformanceTests
Files:
19 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/ChangeLog

    r185654 r185780  
     12015-06-19  Filip Pizlo  <fpizlo@apple.com>
     2
     3        JetStream should include a JavaScript version of the CDx real-time benchmark
     4        https://bugs.webkit.org/show_bug.cgi?id=146156
     5
     6        Reviewed by Geoffrey Garen.
     7       
     8        This adds a JavaScript port of the CDx real-time benchmark to JetStream, and retires
     9        the cordic test because it was previously the smallest and probably least interesting.
     10       
     11        The new test, "cdjs", is mostly a faithful rewrite of the Java code into JavaScript.
     12        I got the Java code from https://www.cs.purdue.edu/sss/projects/cdx/.
     13       
     14        There are some differences:
     15       
     16        - It uses RedBlackTree's for all sets and maps rather than hashtables. This is clearly
     17          more in the spirit of real-time than the CDx benchmark. FWIW, CDx used to use trees
     18          and I don't know why that changed in the latest version.
     19       
     20        - CDjs doesn't attempt to avoid memory allocations, unlike the real-time Java version.
     21          I wrote the code that I wanted to write for aesthetics, rather than the code that I
     22          would have written if I tried to write the fastest code possible. Again, I believe
     23          that this is in the spirit of CDj - it's meant to test what would happen if you wrote
     24          real-timey stuff in a high level language and actually took advantage of that
     25          language to be more productive.
     26       
     27        The test score reflects the average latency of the worst 10 samples out of 200 samples.
     28        The simulation uses 1000 aircraft, flying along paths that result in some detected
     29        collisions every once in a while. The benchmark validates its results by checking the
     30        total number of collisions detected.
     31       
     32        Apart from the integration into the JetStream harness, the CDjs directory contains a
     33        fully self-contained benchmark that could be run either in the jsc shell or in browser.
     34       
     35        This new code uses the same 3-clause BSD license as the Purdue code, and gives
     36        attribution to Purdue in almost all files. I believe that is appropriate since I wrote
     37        most of the JS files by looking at the Purdue Java code and trascribing to JavaScript.
     38        In some cases, I even copy-pasted the Java code, like the complicated math for
     39        four-dimensional intersections and voxel hashing.
     40
     41        * JetStream/CDjsSetup.js: Added.
     42        * JetStream/Octane2Setup.js:
     43        * JetStream/Reference.js:
     44        * JetStream/cdjs: Added.
     45        * JetStream/cdjs/benchmark.js: Added.
     46        (benchmark):
     47        * JetStream/cdjs/call_sign.js: Added.
     48        (CallSign):
     49        (CallSign.prototype.compareTo):
     50        (CallSign.prototype.toString):
     51        * JetStream/cdjs/collision.js: Added.
     52        (Collision):
     53        (Collision.prototype.toString):
     54        * JetStream/cdjs/collision_detector.js: Added.
     55        (CollisionDetector):
     56        (CollisionDetector.prototype.handleNewFrame.get for):
     57        (CollisionDetector.prototype.handleNewFrame):
     58        * JetStream/cdjs/constants.js: Added.
     59        * JetStream/cdjs/main.html: Added.
     60        * JetStream/cdjs/main.js: Added.
     61        * JetStream/cdjs/motion.js: Added.
     62        (Motion):
     63        (Motion.prototype.toString):
     64        (Motion.prototype.delta):
     65        (Motion.prototype.findIntersection):
     66        * JetStream/cdjs/motion_test.js: Added.
     67        (checkDoesIntersect):
     68        (checkDoesNotIntersect):
     69        (makeMotion):
     70        * JetStream/cdjs/red_black_tree.js: Added.
     71        (RedBlackTree):
     72        (RedBlackTree.):
     73        * JetStream/cdjs/red_black_tree_test.js: Added.
     74        (test):
     75        (test.):
     76        * JetStream/cdjs/reduce_collision_set.js: Added.
     77        (drawMotionOnVoxelMap):
     78        (drawMotionOnVoxelMap.):
     79        (.get reduceCollisionSet):
     80        * JetStream/cdjs/reduce_collision_set_test.js: Added.
     81        (makeMotion):
     82        (keys):
     83        (test):
     84        * JetStream/cdjs/simulator.js: Added.
     85        (Simulator):
     86        (Simulator.prototype.simulate):
     87        * JetStream/cdjs/util.js: Added.
     88        (compareNumbers):
     89        (averageAbovePercentile):
     90        (currentTime):
     91        (else.currentTime):
     92        * JetStream/cdjs/vector_2d.js: Added.
     93        (Vector2D):
     94        (Vector2D.prototype.plus):
     95        (Vector2D.prototype.minus):
     96        (Vector2D.prototype.toString):
     97        (Vector2D.prototype.compareTo):
     98        * JetStream/cdjs/vector_3d.js: Added.
     99        (Vector3D):
     100        (Vector3D.prototype.plus):
     101        (Vector3D.prototype.minus):
     102        (Vector3D.prototype.dot):
     103        (Vector3D.prototype.squaredMagnitude):
     104        (Vector3D.prototype.magnitude):
     105        (Vector3D.prototype.times):
     106        (Vector3D.prototype.as2D):
     107        (Vector3D.prototype.toString):
     108        * JetStream/create.rb:
     109        * JetStream/index-TEMPLATE.html:
     110        * JetStream/sunspider/cordic.js: Removed.
     111
    11122015-06-17  Javier Fernandez  <jfernandez@igalia.com>
    2113
  • trunk/PerformanceTests/JetStream/Octane2Setup.js

    r183091 r185780  
    1 // Copyright (C) 2014 Apple Inc. All rights reserved.
     1// Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
    22//
    33// Redistribution and use in source and binary forms, with or without
     
    5050        myBenchmarks.push({
    5151            name: suite.name + "-latency",
    52             prefix: "&sigma; = ",
     52            unit: "ms",
    5353            category: "Latency"
    5454        });
  • trunk/PerformanceTests/JetStream/Reference.js

    r185425 r185780  
    1 // Copyright (C) 2014 Apple Inc. All rights reserved.
     1// Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
    22//
    33// Redistribution and use in source and binary forms, with or without
     
    2626    "3d-raytrace": 8.05,
    2727    "base64": 4.2,
    28     "cordic": 3,
    2928    "crypto-aes": 6.6,
    3029    "crypto-md5": 3,
     
    6665    "typescript": 1149.9999999999993,
    6766    "lua": 29858,
     67    "cdjs": 14,
    6868    "geomean": 31.556451704472156,
    6969});
  • trunk/PerformanceTests/JetStream/create.rb

    r185425 r185780  
    2727require "shellwords"
    2828
    29 VERSION = "1.1-alpha1"
     29VERSION = "1.1-alpha2"
    3030DIRECTORY_NAME = "JetStream-#{VERSION}"
    3131
     
    3535raise unless system("mkdir -p #{DIRECTORY_NAME}/sources")
    3636raise unless system("cp sunspider/*.js #{DIRECTORY_NAME}/sunspider")
    37 raise unless system("cp -r JetStream.css JetStreamDriver.js LLVM-test-suite-LICENSE.txt simple Octane2 Octane2Setup.js SimpleSetup.js SunSpiderSetup.js Octane OctaneSetup.js Reference.js TestingSetup.js JetStream-Logo.png JetStream-Logo@2x.png Swoosh.png Swoosh@2x.png " + DIRECTORY_NAME)
     37raise unless system("cp -r JetStream.css JetStreamDriver.js LLVM-test-suite-LICENSE.txt simple Octane2 Octane2Setup.js SimpleSetup.js SunSpiderSetup.js Octane OctaneSetup.js CDjsSetup.js cdjs Reference.js TestingSetup.js JetStream-Logo.png JetStream-Logo@2x.png Swoosh.png Swoosh@2x.png " + DIRECTORY_NAME)
    3838
    3939def detemplatize(basename)
     
    117117transferSource("zlib", "Octane2/zlib.js", "Octane2/zlib-data.js")
    118118transferSource("typescript", "Octane2/typescript.js", "Octane2/typescript-compiler.js", "Octane2/typescript-input.js")
     119transferSource("cdjs", "cdjs/constants.js", "cdjs/util.js", "cdjs/red_black_tree.js", "cdjs/call_sign.js", "cdjs/vector_2d.js", "cdjs/vector_3d.js", "cdjs/motion.js", "cdjs/reduce_collision_set.js", "cdjs/simulator.js", "cdjs/collision.js", "cdjs/collision_detector.js", "cdjs/benchmark.js")
    119120
    120121puts "You can now run JetStream by navigating to file://" + (Pathname.new(DIRECTORY_NAME) + "index.html").realpath.to_s
  • trunk/PerformanceTests/JetStream/index-TEMPLATE.html

    r183091 r185780  
    4949    <script src="OctaneSetup.js"></script>
    5050    <script src="Octane2Setup.js"></script>
     51    <script src="CDjsSetup.js"></script>
    5152    <script src="Reference.js"></script>
    5253</head>
Note: See TracChangeset for help on using the changeset viewer.