-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from vext01/benchmarks
Add initial benchmarks.
- Loading branch information
Showing
28 changed files
with
5,312 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
pipx install rebench | ||
|
||
# Do a "quick" run as a smoke-test. | ||
~/.local/bin/rebench --quick --no-denoise -c rebench.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM debian:latest | ||
WORKDIR /ci | ||
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \ | ||
--mount=target=/var/cache/apt,type=cache,sharing=locked \ | ||
rm -f /etc/apt/apt.conf.d/docker-clean && \ | ||
apt update && apt install -y pipx lua5.3 git | ||
ARG CI_UID | ||
RUN useradd -m -u ${CI_UID} ci && chown ${CI_UID}:${CI_UID} . | ||
RUN chown ${CI_UID}:${CI_UID} . | ||
COPY --chown=${CI_UID}:${CI_UID} . . | ||
CMD sh -x .buildbot.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
on: | ||
pull_request: | ||
merge_group: | ||
|
||
# This is required to silence emails about the workflow having no jobs. | ||
# We simply define a dummy job that does nothing much. | ||
jobs: | ||
dummy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: /usr/bin/true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
benchmark.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
See the headers in individual benchmarks source files in the `awfy` directory | ||
for their licenses. | ||
|
||
Upstream lists licensing information here: | ||
https://github.com/smarr/are-we-fast-yet/blob/master/LICENSE.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
# Yk Benchmarks | ||
|
||
This is a repository of benchmarks for evaluating the performance of the [yk | ||
meta-tracer](https://github.com/ykjit/yk/). | ||
|
||
## Suites | ||
|
||
At present the following benchmark suites are here: | ||
|
||
| **Suite** | **Languages** | | ||
|--------------------------------------------------------------|---------------| | ||
| [are-we-fast-yet](https://github.com/smarr/are-we-fast-yet/) | Lua | | ||
|
||
## Licenses | ||
|
||
See the `LICENSE-<suite>` files for information on software licenses. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- This code is derived from the SOM benchmarks, see AUTHORS.md file. | ||
-- | ||
-- Copyright (c) 2016 Francois Perrad <[email protected]> | ||
-- | ||
-- Permission is hereby granted, free of charge, to any person obtaining a copy | ||
-- of this software and associated documentation files (the 'Software'), to deal | ||
-- in the Software without restriction, including without limitation the rights | ||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
-- copies of the Software, and to permit persons to whom the Software is | ||
-- furnished to do so, subject to the following conditions: | ||
-- | ||
-- The above copyright notice and this permission notice shall be included in | ||
-- all copies or substantial portions of the Software. | ||
-- | ||
-- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
-- THE SOFTWARE. | ||
|
||
local benchmark = {} do | ||
|
||
function benchmark:inner_benchmark_loop (inner_iterations) | ||
for _ = 1, inner_iterations do | ||
if not self:verify_result(self:benchmark()) then | ||
return false | ||
end | ||
end | ||
return true | ||
end | ||
|
||
function benchmark:benchmark () | ||
error 'subclass_responsibility' | ||
end | ||
|
||
function benchmark:verify_result () | ||
error 'subclass_responsibility' | ||
end | ||
|
||
end | ||
|
||
return benchmark |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
-- This code is derived from the SOM benchmarks, see AUTHORS.md file. | ||
-- | ||
-- Copyright (c) 2016 Francois Perrad <[email protected]> | ||
-- | ||
-- Permission is hereby granted, free of charge, to any person obtaining a copy | ||
-- of this software and associated documentation files (the 'Software'), to deal | ||
-- in the Software without restriction, including without limitation the rights | ||
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
-- copies of the Software, and to permit persons to whom the Software is | ||
-- furnished to do so, subject to the following conditions: | ||
-- | ||
-- The above copyright notice and this permission notice shall be included in | ||
-- all copies or substantial portions of the Software. | ||
-- | ||
-- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
-- THE SOFTWARE. | ||
|
||
local Random = require'som'.Random | ||
|
||
local Ball = {_CLASS = 'Ball'} do | ||
|
||
local abs = math.abs | ||
|
||
function Ball.new (random) | ||
local obj = { | ||
x = random:next() % 500, | ||
y = random:next() % 500, | ||
x_vel = (random:next() % 300) - 150, | ||
y_vel = (random:next() % 300) - 150, | ||
} | ||
return setmetatable(obj, {__index = Ball}) | ||
end | ||
|
||
function Ball:bounce () | ||
local x_limit, y_limit = 500, 500 | ||
local bounced = false | ||
self.x = self.x + self.x_vel | ||
self.y = self.y + self.y_vel | ||
if self.x > x_limit then | ||
self.x = x_limit | ||
self.x_vel = 0 - abs(self.x_vel) | ||
bounced = true | ||
end | ||
if self.x < 0 then | ||
self.x = 0 | ||
self.x_vel = abs(self.x_vel) | ||
bounced = true | ||
end | ||
if self.y > y_limit then | ||
self.y = y_limit | ||
self.y_vel = 0 - abs(self.y_vel) | ||
bounced = true | ||
end | ||
if self.y < 0 then | ||
self.y = 0 | ||
self.y_vel = abs(self.y_vel) | ||
bounced = true | ||
end | ||
return bounced | ||
end | ||
|
||
end -- class Ball | ||
|
||
local bounce = {} do | ||
setmetatable(bounce, {__index = require'benchmark'}) | ||
|
||
function bounce:benchmark () | ||
local random = Random.new() | ||
local ball_count = 100 | ||
local bounces = 0 | ||
local balls = {} | ||
|
||
for i = 1, ball_count do | ||
balls[i] = Ball.new(random) | ||
end | ||
|
||
for _ = 1, 50 do | ||
for i = 1, #balls do | ||
local ball = balls[i] | ||
if ball:bounce() then | ||
bounces = bounces + 1 | ||
end | ||
end | ||
end | ||
return bounces | ||
end | ||
|
||
function bounce:verify_result (result) | ||
return 1331 == result | ||
end | ||
|
||
end -- object bounce | ||
|
||
return bounce |
Oops, something went wrong.