Skip to content

Commit 45c046c

Browse files
committed
change to create a PR
Force a perf regression Increase tests Fix reduce the overhead Reduce iterations Testing Restoring MAJOR_VERSION
1 parent b5c69e7 commit 45c046c

File tree

4 files changed

+34
-28
lines changed

4 files changed

+34
-28
lines changed

.gitlab/benchmarks.yml

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
variables:
22
BASE_CI_IMAGE: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:dd-wasm-js-rewriter
33

4-
.benchmarks:
4+
benchmarks:
55
stage: benchmarks
66
when: on_success
77
tags: ["runner:apm-k8s-tweaked-metal"]
@@ -16,6 +16,7 @@ variables:
1616
- ./steps/run-benchmarks.sh
1717
- ./steps/analyze-results.sh
1818
- "./steps/upload-results-to-s3.sh || :"
19+
- "./steps/post-pr-comment.sh || :"
1920
artifacts:
2021
name: "artifacts"
2122
when: always
@@ -29,28 +30,4 @@ variables:
2930
UPSTREAM_COMMIT_SHA: $CI_COMMIT_SHA # The commit revision the project is built for.
3031
UPSTREAM_PROJECT_ID: $CI_PROJECT_ID # The ID of the current project. This ID is unique across all projects on the GitLab instance.
3132
UPSTREAM_PROJECT_NAME: $CI_PROJECT_NAME # "dd-wasm-js-rewriter"
32-
33-
benchmark:
34-
extends: .benchmarks
35-
parallel:
36-
matrix:
37-
- MAJOR_VERSION: 18
38-
- MAJOR_VERSION: 20
39-
- MAJOR_VERSION: 22
40-
41-
benchmarks-pr-comment:
42-
stage: benchmarks
43-
needs: [ benchmark ]
44-
when: on_success
45-
tags: ["arch:amd64"]
46-
image: $BASE_CI_IMAGE
47-
script:
48-
- export ARTIFACTS_DIR="$(pwd)/artifacts" && (mkdir "${ARTIFACTS_DIR}" || :)
49-
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
50-
- git clone --branch dd-wasm-js-rewriter https://github.com/DataDog/benchmarking-platform platform && cd platform
51-
- ./steps/download-results-from-s3.sh
52-
- ./steps/post-pr-comment.sh
53-
allow_failure: true
54-
variables:
55-
# Gitlab and BP specific env vars. Do not modify.
56-
KUBERNETES_SERVICE_ACCOUNT_OVERWRITE: dd-wasm-js-rewriter
33+
MAJOR_VERSION: 22

benchmark/sirun/rewrite/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
module.exports = {
44
port: 3231 + parseInt(process.env.CPU_AFFINITY || '0'),
5-
reqs: 500
5+
reqs: 300
66
}

benchmark/sirun/rewrite/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "rewrite",
33
"cachegrind": false,
44
"instructions": true,
5-
"iterations": 300,
5+
"iterations": 1,
66
"timeout": 30,
77
"variants": {
88
"iast+orchestrion": {

main.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2022 Datadog, Inc.
44
**/
55
'use strict'
6+
// tiny stupid change to revert
67
const { getPrepareStackTrace, kSymbolPrepareStackTrace } = require('./js/stack-trace/')
78
const { cacheRewrittenSourceMap, getOriginalPathAndLineFromSourceMap } = require('./js/source-map')
89
const getNameAndVersion = require('./js/module-details')
@@ -22,8 +23,27 @@ class DummyRewriter {
2223

2324
let NativeRewriter
2425

26+
function isPrime (num) {
27+
for (let i = 2; i < num; i++) {
28+
if (num % i === 0) {
29+
return false;
30+
}
31+
}
32+
return true;
33+
}
34+
const total = []
2535
class NonCacheRewriter {
2636
constructor (config) {
37+
// force a performance regression
38+
for (let i = 0; i < 1000; i++) {
39+
if (isPrime(i)) {
40+
total.push(i)
41+
}
42+
}
43+
if (total.length < 0) {
44+
console.log('total init', total.length)
45+
}
46+
2747
if (NativeRewriter) {
2848
this.nativeRewriter = new NativeRewriter(config)
2949
this.setLogger(config)
@@ -37,6 +57,15 @@ class NonCacheRewriter {
3757
}
3858

3959
rewrite (code, file, passes) {
60+
// force a performance regression
61+
for (let i = 0; i < 100; i++) {
62+
if (isPrime(i)) {
63+
total.push(i)
64+
}
65+
}
66+
if (total.length < 0) {
67+
console.log('never executed', total.length)
68+
}
4069
let moduleName
4170
let moduleVersion
4271
if (passes.includes('orchestrion')) {

0 commit comments

Comments
 (0)