Merge branch 'master' of https://github.com/h4writer/arewefastyet
This commit is contained in:
Коммит
f551c44e36
|
@ -0,0 +1,50 @@
|
|||
// Since bug 1108290 the JIT optimizes fun.apply(..., array) by taking
|
||||
// a fast inline path when the array is without holes and its length
|
||||
// equals its initialized length.
|
||||
//
|
||||
// This program applies arrays whose length is larger than their
|
||||
// initialized length, thus forcing the bailout path.
|
||||
//
|
||||
// Contrast the running time of this program with the running time of
|
||||
// misc-apply-array.js, which applies arrays whose length equals their
|
||||
// initialized length. That program should run in 1/10 to 1/40 the
|
||||
// time of this one.
|
||||
|
||||
function assertEq(result, expected) {
|
||||
if (result !== expected)
|
||||
throw "Assertion: Expected " + expected + ", got " + result;
|
||||
}
|
||||
|
||||
var iter = 1000;
|
||||
var reps = 100;
|
||||
var sumval = 10; // Sum of a subarray
|
||||
var arrays = [[1,2,3,4],
|
||||
[2,3,4,1],
|
||||
[3,4,1,2],
|
||||
[4,1,2,3],
|
||||
[1,2,3,4],
|
||||
[2,3,4,1],
|
||||
[3,4,1,2],
|
||||
[4,1,2,3]];
|
||||
|
||||
function g(a,b,c,d) {
|
||||
return a+b+c+d;
|
||||
}
|
||||
|
||||
function sumit(a) {
|
||||
var sum = 0;
|
||||
for ( var i=0 ; i < iter ; i++ )
|
||||
sum += g.apply(null, a);
|
||||
return sum;
|
||||
}
|
||||
|
||||
// Trigger a bailout.
|
||||
|
||||
for ( var i=0 ; i < arrays.length ; i++ )
|
||||
arrays[i].length++;
|
||||
|
||||
var osum = 0;
|
||||
for ( var r=0 ; r < reps ; r++ )
|
||||
for ( var i=0 ; i < arrays.length ; i++ )
|
||||
osum += sumit(arrays[i]);
|
||||
assertEq(osum, iter*sumval*reps*arrays.length);
|
|
@ -0,0 +1,45 @@
|
|||
// Since bug 1108290 the JIT optimizes fun.apply(..., array) by taking
|
||||
// a fast inline path when the array is without holes and its length
|
||||
// equals its initialized length.
|
||||
//
|
||||
// This program applies arrays whose length equals their initialized
|
||||
// length, thus triggering the optimization.
|
||||
//
|
||||
// Contrast the running time of this program with the running time of
|
||||
// misc-apply-array-headroom.js, which applies arrays whose length
|
||||
// exceeds their initialized length. That program should run in 10x
|
||||
// to 40x the time of this one.
|
||||
|
||||
function assertEq(result, expected) {
|
||||
if (result !== expected)
|
||||
throw "Assertion: Expected " + expected + ", got " + result;
|
||||
}
|
||||
|
||||
var iter = 1000;
|
||||
var reps = 100;
|
||||
var sumval = 10; // Sum of a subarray
|
||||
var arrays = [[1,2,3,4],
|
||||
[2,3,4,1],
|
||||
[3,4,1,2],
|
||||
[4,1,2,3],
|
||||
[1,2,3,4],
|
||||
[2,3,4,1],
|
||||
[3,4,1,2],
|
||||
[4,1,2,3]];
|
||||
|
||||
function g(a,b,c,d) {
|
||||
return a+b+c+d;
|
||||
}
|
||||
|
||||
function sumit(a) {
|
||||
var sum = 0;
|
||||
for ( var i=0 ; i < iter ; i++ )
|
||||
sum += g.apply(null, a);
|
||||
return sum;
|
||||
}
|
||||
|
||||
var osum = 0;
|
||||
for ( var r=0 ; r < reps ; r++ )
|
||||
for ( var i=0 ; i < arrays.length ; i++ )
|
||||
osum += sumit(arrays[i]);
|
||||
assertEq(osum, iter*sumval*reps*arrays.length);
|
|
@ -113,7 +113,7 @@ class Kraken(SunSpiderBased):
|
|||
|
||||
class Assorted(SunSpiderBased):
|
||||
def __init__(self):
|
||||
super(Assorted, self).__init__('misc', '0.5', 'misc', 3)
|
||||
super(Assorted, self).__init__('misc', '0.6', 'misc', 3)
|
||||
|
||||
class AsmJSBased(Benchmark):
|
||||
def __init__(self, suite, version, folder):
|
||||
|
|
|
@ -70,14 +70,17 @@ class ChromeRevisionFinder(RevisionFinder):
|
|||
return "http://commondatastorage.googleapis.com/chromium-browser-continuous/"+platform+"/"
|
||||
|
||||
def _platform(self):
|
||||
arch, _ = platform.architecture()
|
||||
arch = arch[0:2]
|
||||
if platform.system() == "Linux":
|
||||
return "Linux"
|
||||
if platform.system() == "Darwin":
|
||||
return "Mac"
|
||||
if platform.system() == "Windows":
|
||||
return "Win"
|
||||
if platform.system().startswith("CYGWIN"):
|
||||
return "Win"
|
||||
if platform.system() == "Windows" or platform.system().startswith("CYGWIN"):
|
||||
if arch == '32':
|
||||
return "Win"
|
||||
elif arch == '64':
|
||||
return "Win_x64"
|
||||
raise Exception("Unknown platform: " + platform.system())
|
||||
|
||||
def latest(self):
|
||||
|
|
|
@ -127,14 +127,15 @@ class ChromeExecutor(BrowserExecutor):
|
|||
#"osx_mount_point": "/Volumes/Nightly",
|
||||
#"osx_binary": "/Volumes/Nightly/Nightly.app/Contents/MacOS/firefox",
|
||||
#"android_processname": "org.mozilla.fennec"
|
||||
"linux_processname": "chrome"
|
||||
"linux_processname": "chrome",
|
||||
"windows_processname": "chrome.exe"
|
||||
})
|
||||
|
||||
# kill all possible running instances.
|
||||
runner.killAllInstances()
|
||||
|
||||
# make binary executable
|
||||
runner.set_exec_bit(self.engineInfo["binary"])
|
||||
# if needed install the executable
|
||||
binary = runner.install(self.engineInfo["binary"])
|
||||
|
||||
# Chromium Helper needs to be executable too
|
||||
helpers = runner.find(self.engineInfo["folder"], "Chromium Helper")
|
||||
|
@ -145,7 +146,7 @@ class ChromeExecutor(BrowserExecutor):
|
|||
self.resetResults()
|
||||
|
||||
# start browser
|
||||
process = runner.start(self.engineInfo["binary"], ["--disable-setuid-sandbox"] + args, env)
|
||||
process = runner.start(binary, ["--disable-setuid-sandbox"] + args, env)
|
||||
|
||||
# wait for results
|
||||
self.waitForResults()
|
||||
|
|
|
@ -19,14 +19,11 @@ class FakeHandler(SimpleHTTPRequestHandler):
|
|||
with utils.Handler(signal.SIGALRM, utils.timeout_handler):
|
||||
try:
|
||||
signal.alarm(20)
|
||||
|
||||
SimpleHTTPRequestHandler.handle_one_request(self)
|
||||
|
||||
signal.alarm(0)
|
||||
except utils.TimeException:
|
||||
print "timeout"
|
||||
pass
|
||||
|
||||
finally:
|
||||
signal.alarm(0)
|
||||
|
||||
def do_GET(self):
|
||||
if self.remoteBenchmark():
|
||||
|
|
|
@ -7,6 +7,7 @@ import re
|
|||
import urllib
|
||||
import urllib2
|
||||
import json
|
||||
import contextlib
|
||||
|
||||
import utils
|
||||
|
||||
|
@ -57,13 +58,13 @@ class RemoteSubmitter(Submitter):
|
|||
url += '&MACHINE=' + str(self.machine)
|
||||
if timestamp:
|
||||
url += "&stamp=" + str(timestamp)
|
||||
url = urllib2.urlopen(url)
|
||||
contents = url.read()
|
||||
m = re.search('id=(\d+)', contents)
|
||||
if m == None:
|
||||
self.runIds[i] = None
|
||||
else:
|
||||
self.runIds[i] = int(m.group(1))
|
||||
with contextlib.closing(urllib2.urlopen(url)) as url:
|
||||
contents = url.read()
|
||||
m = re.search('id=(\d+)', contents)
|
||||
if m == None:
|
||||
self.runIds[i] = None
|
||||
else:
|
||||
self.runIds[i] = int(m.group(1))
|
||||
except urllib2.URLError:
|
||||
self.runIds[i] = None
|
||||
|
||||
|
@ -78,13 +79,13 @@ class RemoteSubmitter(Submitter):
|
|||
url += '&revision=' + str(revision)
|
||||
url += '&run_before_id=' + str(run_before)
|
||||
url += '&run_after_id=' + str(run_after)
|
||||
url = urllib2.urlopen(url)
|
||||
contents = url.read()
|
||||
m = re.search('id=(\d+)', contents)
|
||||
if m == None:
|
||||
self.runIds[i] = None
|
||||
else:
|
||||
self.runIds[i] = int(m.group(1))
|
||||
with contextlib.closing(urllib2.urlopen(url)) as url:
|
||||
contents = url.read()
|
||||
m = re.search('id=(\d+)', contents)
|
||||
if m == None:
|
||||
self.runIds[i] = None
|
||||
else:
|
||||
self.runIds[i] = int(m.group(1))
|
||||
except urllib2.URLError:
|
||||
self.runIds[i] = None
|
||||
|
||||
|
@ -100,7 +101,8 @@ class RemoteSubmitter(Submitter):
|
|||
'cset': cset
|
||||
}
|
||||
url = self.urls[i] + '?' + urllib.urlencode(args)
|
||||
urllib2.urlopen(url)
|
||||
with contextlib.closing(urllib2.urlopen(url)) as url:
|
||||
pass
|
||||
return mode
|
||||
|
||||
def addTests(self, tests, suite, suiteversion, mode, extra_info = ""):
|
||||
|
@ -133,13 +135,13 @@ class RemoteSubmitter(Submitter):
|
|||
'extra_info': extra_info
|
||||
}
|
||||
url = submiturl + '?' + urllib.urlencode(args)
|
||||
url = urllib2.urlopen(url)
|
||||
contents = url.read()
|
||||
m = re.search('id=(\d+)', contents)
|
||||
if m == None:
|
||||
return None
|
||||
else:
|
||||
return int(m.group(1))
|
||||
with contextlib.closing(urllib2.urlopen(url)) as url:
|
||||
contents = url.read()
|
||||
m = re.search('id=(\d+)', contents)
|
||||
if m == None:
|
||||
return None
|
||||
else:
|
||||
return int(m.group(1))
|
||||
except urllib2.URLError:
|
||||
return None
|
||||
|
||||
|
@ -154,7 +156,8 @@ class RemoteSubmitter(Submitter):
|
|||
'time': str(time)
|
||||
}
|
||||
url = submiturl + '?' + urllib.urlencode(args)
|
||||
urllib2.urlopen(url)
|
||||
with contextlib.closing(urllib2.urlopen(url)) as url:
|
||||
pass
|
||||
|
||||
def finish(self, status = 1):
|
||||
for i in range(len(self.urls)):
|
||||
|
@ -165,7 +168,8 @@ class RemoteSubmitter(Submitter):
|
|||
url += '?run=finish'
|
||||
url += '&status=' + str(status)
|
||||
url += '&runid=' + str(self.runIds[i])
|
||||
urllib2.urlopen(url)
|
||||
with contextlib.closing(urllib2.urlopen(url)) as url:
|
||||
pass
|
||||
|
||||
class PrintSubmitter(Submitter):
|
||||
def __init__(self):
|
||||
|
|
Загрузка…
Ссылка в новой задаче