-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
25 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
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
39 changes: 39 additions & 0 deletions
39
test/functionality/dataflow/processing-of-elements/loops/while-loop-tests.ts
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,39 @@ | ||
import { DataflowGraph, EdgeType, initializeCleanEnvironments } from '../../../../../src/dataflow' | ||
import { define } from '../../../../../src/dataflow/environments' | ||
import { LocalScope } from '../../../../../src/dataflow/environments/scopes' | ||
import { assertDataflow, withShell } from '../../../_helper/shell' | ||
|
||
describe('while', withShell(shell => { | ||
assertDataflow('simple constant while', shell, | ||
'while (TRUE) 2', | ||
new DataflowGraph() | ||
) | ||
assertDataflow('using variable in body', shell, | ||
'while (TRUE) x', | ||
new DataflowGraph().addVertex({ tag: 'use', id: '1', name: 'x', when: 'maybe' }) | ||
) | ||
assertDataflow('assignment in loop body', shell, | ||
'while (TRUE) { x <- 3 }', | ||
new DataflowGraph().addVertex({ tag: 'variable-definition', id: '1', name: 'x', scope: LocalScope, when: 'maybe' }) | ||
) | ||
assertDataflow('def compare in loop', shell, 'while ((x <- x - 1) > 0) { x }', | ||
new DataflowGraph() | ||
.addVertex({ tag: 'variable-definition', id: '0', name: 'x', scope: LocalScope }) | ||
.addVertex({ tag: 'use', id: '1', name: 'x' }) | ||
.addVertex({ tag: 'use', id: '7', name: 'x', when: 'maybe', environment: define({ name: 'x', nodeId: '0', definedAt: '4', used: 'always', kind: 'variable', scope: LocalScope }, LocalScope, initializeCleanEnvironments()) }) | ||
.addEdge('7', '0', EdgeType.Reads, 'maybe') | ||
.addEdge('0', '1', EdgeType.DefinedBy, 'always') | ||
) | ||
assertDataflow('Endless while loop', | ||
shell, | ||
'while(TRUE) 1', | ||
new DataflowGraph() | ||
) | ||
assertDataflow('Endless while loop with variables', | ||
shell, | ||
'while(x) y', | ||
new DataflowGraph() | ||
.addVertex({ tag: 'use', id: '0', name: 'x', when: 'always' }) | ||
.addVertex({ tag: 'use', id: '1', name: 'y', when: 'maybe' }) | ||
) | ||
})) |
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
f9ee22b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"artificial" Benchmark Suite
Total per-file
3547.504575681818
ms (4262.3937595002935
)3354.2152301363635
ms (3860.1297956846133
)1.06
Retrieve AST from R code
73.33157477272727
ms (146.2124749198712
)71.48860922727273
ms (136.54310977165716
)1.03
Normalize R AST
95.82382081818182
ms (155.4568734518132
)95.79139172727274
ms (152.52195436786488
)1.00
Produce dataflow information
67.71687972727274
ms (173.29206735903242
)66.23299468181818
ms (170.60548403093352
)1.02
Total per-slice
1.9285465716535226
ms (1.398522808136136
)1.8581676256634037
ms (1.2492897864296644
)1.04
Static slicing
1.403316623665246
ms (1.2754439842557703
)1.372047543536089
ms (1.1480006540491348
)1.02
Reconstruct code
0.5076897611868573
ms (0.2992931861781087
)0.46882655148163743
ms (0.2603715463019149
)1.08
failed to reconstruct/re-parse
0
#0
#NaN
times hit threshold
0
#0
#NaN
reduction (characters)
0.7329390759026896
#0.7329390759026896
#1
reduction (normalized tokens)
0.720988345209971
#0.720988345209971
#1
This comment was automatically generated by workflow using github-action-benchmark.
f9ee22b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"social-science" Benchmark Suite
Total per-file
5475.94640092
ms (5978.228890792333
)5464.289228619999
ms (6098.39318648839
)1.00
Retrieve AST from R code
83.0946157
ms (73.97431567736152
)86.76445109999999
ms (77.45681339952834
)0.96
Normalize R AST
112.00676481999999
ms (70.34816898602243
)113.78691086
ms (69.64981912121678
)0.98
Produce dataflow information
166.08868618
ms (281.3506281409519
)166.90590034000002
ms (285.57711744755056
)1.00
Total per-slice
8.693413426118177
ms (14.494059889656484
)8.863963769870134
ms (14.566635289387673
)0.98
Static slicing
8.146732710966292
ms (14.355045322667577
)8.249822291669334
ms (14.448470605228648
)0.99
Reconstruct code
0.5373259186440625
ms (0.28398997358094125
)0.6040326772298797
ms (0.31033593750624766
)0.89
failed to reconstruct/re-parse
9
#9
#1
times hit threshold
967
#967
#1
reduction (characters)
0.898713819973478
#0.898713819973478
#1
reduction (normalized tokens)
0.8579790415512589
#0.8579790415512589
#1
This comment was automatically generated by workflow using github-action-benchmark.