We will be at OWASP APPSEC EUROPE 2017 - Belfast! Let’s talk!MORE INFO

Help Center

Get to know more about our API, Code Annotations and Code Transformations

Dead Code Elimination

Potency
1 / 3
Resilience
5 / 5
Cost
0 / 5

Tags: dead,optimization,removal,elimination

Description

Dead code is code that is never executed. Dead Code Elimination removes
dead code from your program resulting in a smaller program that behaves
exactly the same.

Example

The following example contains dead code:

1
2
3
4
5
6
7
8
9
10
11
12
13
while (true) {
if (key === 'up') {
shoot();
} else if (false) {
// this is unreachable code
deleteShip();
} else {
key = 'exit'
break;
// this is also unreachable code
key = 'down';
}
}

The resulting code looks like this:

1
2
3
4
5
6
7
8
while (true) {
if (key === 'up') {
shoot();
} else {
key = 'exit';
break;
}
}

API Parameters

Example:

1
2
3
4
5
6
7
8
9
10
11
12
{
"keys": {
"accessKey": "XXXXXX",
"secretKey": "YYYYYY"
},
"applicationId": "ZZZZZZ",
"params": [
{
"name": "deadCodeElimination"
}
]
}