@eagleoutice/flowr 2.2.11 → 2.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -20
- package/benchmark/slicer.d.ts +49 -22
- package/benchmark/slicer.js +89 -29
- package/benchmark/stats/print.js +16 -10
- package/benchmark/stats/size-of.js +18 -1
- package/benchmark/stats/stats.d.ts +3 -0
- package/benchmark/summarizer/first-phase/input.js +1 -1
- package/benchmark/summarizer/first-phase/process.js +3 -3
- package/benchmark/summarizer/second-phase/process.js +9 -3
- package/benchmark/summarizer/summarizer.js +1 -1
- package/cli/benchmark-app.d.ts +5 -0
- package/cli/benchmark-app.js +49 -6
- package/cli/benchmark-helper-app.d.ts +4 -0
- package/cli/benchmark-helper-app.js +20 -4
- package/cli/common/options.js +15 -6
- package/cli/common/script.js +1 -1
- package/cli/flowr.js +1 -1
- package/cli/repl/commands/repl-cfg.d.ts +2 -0
- package/cli/repl/commands/repl-cfg.js +38 -24
- package/cli/repl/commands/repl-commands.js +6 -2
- package/cli/repl/commands/repl-dataflow.d.ts +2 -0
- package/cli/repl/commands/repl-dataflow.js +37 -3
- package/cli/repl/commands/repl-execute.js +1 -1
- package/cli/repl/commands/repl-main.d.ts +1 -1
- package/cli/repl/commands/repl-main.js +1 -1
- package/cli/repl/commands/repl-normalize.js +1 -1
- package/cli/repl/commands/repl-query.js +2 -2
- package/cli/repl/core.js +1 -1
- package/cli/repl/prompt.js +1 -1
- package/cli/repl/server/connection.js +4 -4
- package/cli/repl/server/messages/message-analysis.d.ts +1 -1
- package/cli/script-core/statistics-core.js +1 -1
- package/cli/script-core/statistics-helper-core.js +4 -4
- package/config.d.ts +60 -21
- package/config.js +24 -4
- package/control-flow/basic-cfg-guided-visitor.d.ts +39 -0
- package/control-flow/basic-cfg-guided-visitor.js +114 -0
- package/control-flow/cfg-properties.d.ts +26 -0
- package/control-flow/cfg-properties.js +100 -0
- package/control-flow/cfg-simplification.d.ts +18 -0
- package/control-flow/cfg-simplification.js +55 -0
- package/control-flow/cfg-to-basic-blocks.d.ts +5 -0
- package/control-flow/cfg-to-basic-blocks.js +81 -0
- package/control-flow/control-flow-graph.d.ts +247 -0
- package/control-flow/control-flow-graph.js +290 -0
- package/control-flow/dfg-cfg-guided-visitor.d.ts +32 -0
- package/control-flow/dfg-cfg-guided-visitor.js +71 -0
- package/control-flow/diff-cfg.d.ts +11 -0
- package/control-flow/diff-cfg.js +161 -0
- package/control-flow/extract-cfg.d.ts +30 -0
- package/control-flow/extract-cfg.js +475 -0
- package/control-flow/happens-before.d.ts +7 -0
- package/{util/cfg → control-flow}/happens-before.js +3 -3
- package/control-flow/semantic-cfg-guided-visitor.d.ts +452 -0
- package/control-flow/semantic-cfg-guided-visitor.js +492 -0
- package/control-flow/simple-visitor.d.ts +25 -0
- package/control-flow/simple-visitor.js +80 -0
- package/control-flow/syntax-cfg-guided-visitor.d.ts +128 -0
- package/control-flow/syntax-cfg-guided-visitor.js +166 -0
- package/core/print/print.d.ts +1 -1
- package/core/print/slice-diff-ansi.js +1 -1
- package/core/steps/pipeline/create-pipeline.js +1 -1
- package/dataflow/environments/built-in-config.d.ts +5 -2
- package/dataflow/environments/built-in-config.js +17 -8
- package/dataflow/environments/built-in.d.ts +16 -5
- package/dataflow/environments/built-in.js +55 -6
- package/dataflow/environments/clone.d.ts +5 -0
- package/dataflow/environments/clone.js +5 -0
- package/dataflow/environments/default-builtin-config.d.ts +2 -0
- package/dataflow/environments/default-builtin-config.js +164 -13
- package/dataflow/environments/define.d.ts +5 -1
- package/dataflow/environments/define.js +36 -10
- package/dataflow/environments/overwrite.js +4 -0
- package/dataflow/environments/remove.d.ts +6 -0
- package/dataflow/environments/remove.js +24 -0
- package/dataflow/environments/resolve-by-name.js +16 -5
- package/dataflow/extractor.js +2 -2
- package/dataflow/graph/dataflowgraph-builder.d.ts +79 -7
- package/dataflow/graph/dataflowgraph-builder.js +106 -8
- package/dataflow/graph/diff-dataflow-graph.d.ts +16 -0
- package/dataflow/graph/{diff.js → diff-dataflow-graph.js} +30 -56
- package/dataflow/graph/graph.d.ts +17 -4
- package/dataflow/graph/graph.js +51 -12
- package/dataflow/graph/vertex.d.ts +59 -4
- package/dataflow/graph/vertex.js +32 -0
- package/dataflow/internal/linker.d.ts +3 -2
- package/dataflow/internal/linker.js +36 -25
- package/dataflow/internal/process/functions/call/argument/unpack-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +67 -54
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +6 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +108 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +54 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +10 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +140 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +9 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +15 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +51 -17
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +9 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +4 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +100 -31
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +7 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +41 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +35 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +4 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.d.ts +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-vector.js +75 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +3 -3
- package/dataflow/internal/process/functions/call/common.d.ts +5 -2
- package/dataflow/internal/process/functions/call/common.js +9 -5
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +3 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +2 -0
- package/dataflow/internal/process/functions/call/named-call-handling.js +10 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.d.ts +1 -0
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +6 -4
- package/dataflow/internal/process/process-named-call.d.ts +4 -1
- package/dataflow/internal/process/process-named-call.js +8 -5
- package/dataflow/origin/dfg-get-origin.d.ts +82 -0
- package/dataflow/origin/dfg-get-origin.js +116 -0
- package/documentation/doc-util/doc-cfg.d.ts +20 -4
- package/documentation/doc-util/doc-cfg.js +41 -7
- package/documentation/doc-util/doc-cli-option.js +4 -2
- package/documentation/doc-util/doc-code.js +10 -2
- package/documentation/doc-util/doc-dfg.js +3 -3
- package/documentation/doc-util/doc-escape.d.ts +7 -0
- package/documentation/doc-util/doc-escape.js +19 -0
- package/documentation/doc-util/doc-files.d.ts +1 -0
- package/documentation/doc-util/doc-files.js +2 -1
- package/documentation/doc-util/doc-normalized-ast.js +3 -3
- package/documentation/doc-util/doc-query.js +2 -2
- package/documentation/doc-util/doc-repl.js +1 -1
- package/documentation/doc-util/doc-search.js +1 -1
- package/documentation/doc-util/doc-server-message.js +2 -2
- package/documentation/doc-util/doc-structure.d.ts +1 -0
- package/documentation/doc-util/doc-structure.js +5 -0
- package/documentation/doc-util/doc-types.d.ts +7 -1
- package/documentation/doc-util/doc-types.js +13 -2
- package/documentation/print-capabilities-markdown.js +28 -2
- package/documentation/print-cfg-wiki.d.ts +1 -0
- package/documentation/print-cfg-wiki.js +572 -0
- package/documentation/print-core-wiki.js +2 -2
- package/documentation/print-dataflow-graph-wiki.js +180 -25
- package/documentation/print-engines-wiki.js +1 -1
- package/documentation/print-faq-wiki.d.ts +1 -0
- package/documentation/print-faq-wiki.js +75 -0
- package/documentation/print-interface-wiki.js +2 -1
- package/documentation/print-linting-and-testing-wiki.js +52 -36
- package/documentation/print-normalized-ast-wiki.js +1 -1
- package/documentation/print-onboarding-wiki.d.ts +1 -0
- package/documentation/print-onboarding-wiki.js +42 -0
- package/documentation/print-query-wiki.js +23 -3
- package/documentation/print-readme.js +10 -3
- package/package.json +10 -6
- package/queries/catalog/call-context-query/call-context-query-executor.js +5 -5
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-format.js +2 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -2
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +24 -21
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +1 -1
- package/queries/catalog/cluster-query/cluster-query-format.js +1 -1
- package/queries/catalog/config-query/config-query-format.d.ts +1 -1
- package/queries/catalog/config-query/config-query-format.js +2 -2
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-lens-query/dataflow-lens-query-format.js +2 -2
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +1 -1
- package/queries/catalog/dataflow-query/dataflow-query-format.js +2 -2
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +17 -7
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +2 -26
- package/queries/catalog/dependencies-query/dependencies-query-format.js +4 -147
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +24 -0
- package/queries/catalog/dependencies-query/function-info/function-info.js +10 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/library-functions.js +18 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/read-functions.js +101 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/source-functions.js +11 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/write-functions.js +87 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +4 -4
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.js +2 -2
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +1 -1
- package/queries/catalog/id-map-query/id-map-query-format.js +2 -2
- package/queries/catalog/lineage-query/lineage-query-format.d.ts +1 -1
- package/queries/catalog/lineage-query/lineage-query-format.js +2 -2
- package/queries/catalog/location-map-query/location-map-query-format.d.ts +1 -1
- package/queries/catalog/location-map-query/location-map-query-format.js +2 -2
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +2 -2
- package/queries/catalog/origin-query/origin-query-executor.d.ts +5 -0
- package/queries/catalog/origin-query/origin-query-executor.js +33 -0
- package/queries/catalog/origin-query/origin-query-format.d.ts +71 -0
- package/queries/catalog/origin-query/origin-query-format.js +27 -0
- package/queries/catalog/project-query/project-query-format.d.ts +1 -1
- package/queries/catalog/project-query/project-query-format.js +2 -2
- package/queries/catalog/resolve-value-query/resolve-value-query-format.d.ts +1 -1
- package/queries/catalog/resolve-value-query/resolve-value-query-format.js +2 -2
- package/queries/catalog/search-query/search-query-format.d.ts +1 -1
- package/queries/catalog/search-query/search-query-format.js +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +1 -1
- package/queries/catalog/static-slice-query/static-slice-query-format.js +2 -2
- package/queries/query-print.d.ts +1 -1
- package/queries/query-print.js +4 -4
- package/queries/query.d.ts +61 -2
- package/queries/query.js +3 -1
- package/r-bridge/data/data.d.ts +2 -2
- package/r-bridge/data/data.js +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +3 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-root.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +4 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +26 -8
- package/r-bridge/retriever.js +1 -1
- package/search/search-executor/search-generators.d.ts +1 -1
- package/search/search-executor/search-transformer.d.ts +1 -1
- package/slicing/criterion/collect-all.js +1 -1
- package/slicing/static/slice-call.js +13 -3
- package/statistics/features/supported/assignments/post-process.js +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -2
- package/statistics/features/supported/used-functions/post-process.js +1 -1
- package/statistics/features/supported/used-packages/post-process.js +2 -2
- package/statistics/features/supported/values/post-process.js +2 -2
- package/statistics/output/print-stats.js +2 -2
- package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
- package/statistics/summarizer/post-process/clusterer.js +1 -1
- package/statistics/summarizer/post-process/histogram.js +3 -3
- package/statistics/summarizer/post-process/post-process-output.js +3 -3
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +2 -2
- package/util/assert.js +36 -1
- package/util/cfg/cfg.d.ts +0 -80
- package/util/cfg/cfg.js +0 -549
- package/util/{arrays.d.ts → collections/arrays.d.ts} +24 -1
- package/util/{arrays.js → collections/arrays.js} +44 -3
- package/util/collections/set.js +17 -0
- package/util/{list-access.d.ts → containers.d.ts} +24 -4
- package/util/{list-access.js → containers.js} +42 -12
- package/util/diff-graph.d.ts +47 -0
- package/util/diff-graph.js +61 -0
- package/util/diff.d.ts +6 -6
- package/util/diff.js +1 -1
- package/util/mermaid/ast.js +12 -1
- package/util/mermaid/cfg.d.ts +9 -2
- package/util/mermaid/cfg.js +65 -13
- package/util/mermaid/dfg.d.ts +2 -1
- package/util/mermaid/dfg.js +26 -10
- package/util/mermaid/mermaid.d.ts +2 -0
- package/util/mermaid/mermaid.js +6 -0
- package/util/parallel.d.ts +2 -1
- package/util/parallel.js +11 -2
- package/util/prefix.d.ts +13 -0
- package/util/prefix.js +34 -0
- package/util/quads.js +1 -1
- package/util/schema.d.ts +1 -1
- package/util/schema.js +1 -1
- package/util/summarizer.js +1 -1
- package/util/{text.js → text/text.js} +1 -1
- package/util/{time.js → text/time.js} +1 -1
- package/util/version.js +1 -1
- package/dataflow/graph/diff.d.ts +0 -36
- package/util/cfg/happens-before.d.ts +0 -7
- package/util/cfg/visitor.d.ts +0 -9
- package/util/cfg/visitor.js +0 -30
- package/util/set.js +0 -31
- /package/util/{bimap.d.ts → collections/bimap.d.ts} +0 -0
- /package/util/{bimap.js → collections/bimap.js} +0 -0
- /package/util/{defaultmap.d.ts → collections/defaultmap.d.ts} +0 -0
- /package/util/{defaultmap.js → collections/defaultmap.js} +0 -0
- /package/util/{set.d.ts → collections/set.d.ts} +0 -0
- /package/util/{ansi.d.ts → text/ansi.d.ts} +0 -0
- /package/util/{ansi.js → text/ansi.js} +0 -0
- /package/util/{args.d.ts → text/args.d.ts} +0 -0
- /package/util/{args.js → text/args.js} +0 -0
- /package/util/{strings.d.ts → text/strings.d.ts} +0 -0
- /package/util/{strings.js → text/strings.js} +0 -0
- /package/util/{text.d.ts → text/text.d.ts} +0 -0
- /package/util/{time.d.ts → text/time.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
[](https://hub.docker.com/r/eagleoutice/flowr)
|
|
5
5
|
[](https://github.com/flowr-analysis/flowr/releases/latest)
|
|
6
6
|
[](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr)
|
|
7
|
+
[](https://open-vsx.org/extension/code-inspect/vscode-flowr)
|
|
7
8
|
[](https://zenodo.org/doi/10.5281/zenodo.13319290)
|
|
8
9
|
|
|
9
|
-
_flowR_ is a sophisticated, static [dataflow analyzer](https://en.wikipedia.org/wiki/Data-flow_analysis) for the [R programming language](https://www.r-project.org/)
|
|
10
|
+
_flowR_ is a sophisticated, static [dataflow analyzer](https://en.wikipedia.org/wiki/Data-flow_analysis) for the [R programming language](https://www.r-project.org/),
|
|
11
|
+
available for [VSCode](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr), [Positron](https://open-vsx.org/extension/code-inspect/vscode-flowr), [RStudio](https://github.com/flowr-analysis/rstudio-addin-flowr),
|
|
12
|
+
and [Docker](https://hub.docker.com/r/eagleoutice/flowr).
|
|
10
13
|
It offers a wide variety of features, for example:
|
|
11
14
|
|
|
12
15
|
* 🍕 **program slicing**\
|
|
@@ -48,7 +51,7 @@ It offers a wide variety of features, for example:
|
|
|
48
51
|
|
|
49
52
|
```shell
|
|
50
53
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
51
|
-
flowR repl using flowR v2.2.
|
|
54
|
+
flowR repl using flowR v2.2.12, R v4.4.3 (r-shell engine)
|
|
52
55
|
R> :slicer test/testfiles/example.R --criterion "11@sum"
|
|
53
56
|
```
|
|
54
57
|
|
|
@@ -95,7 +98,7 @@ It offers a wide variety of features, for example:
|
|
|
95
98
|
|
|
96
99
|
|
|
97
100
|
* 🚀 **fast data- and control-flow graphs**\
|
|
98
|
-
Within just <i><span title="This measurement is automatically fetched from the latest benchmark!">
|
|
101
|
+
Within just <i><span title="This measurement is automatically fetched from the latest benchmark!">124.8 ms</span></i> (as of Mar 17, 2025),
|
|
99
102
|
_flowR_ can analyze the data- and control-flow of the average real-world R script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
|
|
100
103
|
and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the dataflow graph.
|
|
101
104
|
|
|
@@ -104,7 +107,7 @@ It offers a wide variety of features, for example:
|
|
|
104
107
|
|
|
105
108
|
|
|
106
109
|
You can investigate flowR's analyses using the [REPL](https://github.com/flowr-analysis/flowr/wiki/Interface#using-the-repl).
|
|
107
|
-
Commands like <span title="Description (Repl Command, starred version): Returns the URL to mermaid.live; Base Command: Get mermaid code for the dataflow graph
|
|
110
|
+
Commands like <span title="Description (Repl Command, starred version): Returns the URL to mermaid.live; Base Command: Get mermaid code for the dataflow graph, start with 'file://' to indicate a file (aliases: :d*, :df*)">`:dataflow*`</span> allow you to view a dataflow graph for a given R script.
|
|
108
111
|
|
|
109
112
|
Let's have a look at the following example:
|
|
110
113
|
|
|
@@ -131,7 +134,7 @@ It offers a wide variety of features, for example:
|
|
|
131
134
|
|
|
132
135
|
```shell
|
|
133
136
|
$ docker run -it --rm eagleoutice/flowr # or npm run flowr
|
|
134
|
-
flowR repl using flowR v2.2.
|
|
137
|
+
flowR repl using flowR v2.2.12, R v4.4.3 (r-shell engine)
|
|
135
138
|
R> :dataflow* test/testfiles/example.R
|
|
136
139
|
```
|
|
137
140
|
|
|
@@ -140,7 +143,7 @@ It offers a wide variety of features, for example:
|
|
|
140
143
|
|
|
141
144
|
|
|
142
145
|
```text
|
|
143
|
-
https://mermaid.live/view#base64:
|
|
146
|
+
https://mermaid.live/view#base64:eyJjb2RlIjoiZmxvd2NoYXJ0IEJUXG4gICAgMChbXCJgIzkxO1JTeW1ib2wjOTM7IHRlc3RcbiAgICAgICgwKVxuICAgICAgKjEuMS00KmBcIl0pXG4gICAgMShbXCJgIzkxO1JTeW1ib2wjOTM7IHRlc3RmaWxlc1xuICAgICAgKDEpXG4gICAgICAqMS42LTE0KmBcIl0pXG4gICAgMltbXCJgIzkxO1JCaW5hcnlPcCM5MzsgL1xuICAgICAgKDIpXG4gICAgICAqMS4xLTE0KlxuICAgICgwLCAxKWBcIl1dXG4gICAgYnVpbHQtaW46X1tcImBCdWlsdC1Jbjpcbi9gXCJdXG4gICAgc3R5bGUgYnVpbHQtaW46XyBzdHJva2U6Z3JheSxmaWxsOmxpZ2h0Z3JheSxzdHJva2Utd2lkdGg6MnB4LG9wYWNpdHk6Ljg7XG4gICAgMyhbXCJgIzkxO1JTeW1ib2wjOTM7IGV4YW1wbGUuUlxuICAgICAgKDMpXG4gICAgICAqMS4xNi0yNCpgXCJdKVxuICAgIDRbW1wiYCM5MTtSQmluYXJ5T3AjOTM7IC9cbiAgICAgICg0KVxuICAgICAgKjEuMS0yNCpcbiAgICAoMiwgMylgXCJdXVxuICAgIDIgLS0+fFwicmVhZHMsIGFyZ3VtZW50XCJ8IDBcbiAgICAyIC0tPnxcInJlYWRzLCBhcmd1bWVudFwifCAxXG4gICAgMiAtLi0+fFwicmVhZHMsIGNhbGxzXCJ8IGJ1aWx0LWluOl9cbiAgICBsaW5rU3R5bGUgMiBzdHJva2U6Z3JheTtcbiAgICA0IC0tPnxcInJlYWRzLCBhcmd1bWVudFwifCAyXG4gICAgNCAtLT58XCJyZWFkcywgYXJndW1lbnRcInwgM1xuICAgIDQgLS4tPnxcInJlYWRzLCBjYWxsc1wifCBidWlsdC1pbjpfXG4gICAgbGlua1N0eWxlIDUgc3Ryb2tlOmdyYXk7IiwibWVybWFpZCI6eyJhdXRvU3luYyI6dHJ1ZX19
|
|
144
147
|
```
|
|
145
148
|
|
|
146
149
|
|
|
@@ -162,6 +165,9 @@ It offers a wide variety of features, for example:
|
|
|
162
165
|
(2)
|
|
163
166
|
*1.1-8*
|
|
164
167
|
(0, 1)`"]]
|
|
168
|
+
built-in:_-["`Built-In:
|
|
169
|
+
#60;#45;`"]
|
|
170
|
+
style built-in:_- stroke:gray,fill:lightgray,stroke-width:2px,opacity:.8;
|
|
165
171
|
4{{"`#91;RNumber#93; 1
|
|
166
172
|
(4)
|
|
167
173
|
*2.12*`"}}
|
|
@@ -208,14 +214,23 @@ It offers a wide variety of features, for example:
|
|
|
208
214
|
(18)
|
|
209
215
|
*6.14-16*
|
|
210
216
|
(16, 17)`"]]
|
|
217
|
+
built-in:-["`Built-In:
|
|
218
|
+
#45;`"]
|
|
219
|
+
style built-in:- stroke:gray,fill:lightgray,stroke-width:2px,opacity:.8;
|
|
211
220
|
19[["`#91;RExpressionList#93; (
|
|
212
221
|
(19)
|
|
213
222
|
*6.13*
|
|
214
223
|
(18)`"]]
|
|
224
|
+
built-in:_["`Built-In:
|
|
225
|
+
(`"]
|
|
226
|
+
style built-in:_ stroke:gray,fill:lightgray,stroke-width:2px,opacity:.8;
|
|
215
227
|
20[["`#91;RBinaryOp#93; #58;
|
|
216
228
|
(20)
|
|
217
229
|
*6.11-17*
|
|
218
230
|
(13, 19)`"]]
|
|
231
|
+
built-in::["`Built-In:
|
|
232
|
+
#58;`"]
|
|
233
|
+
style built-in:: stroke:gray,fill:lightgray,stroke-width:2px,opacity:.8;
|
|
219
234
|
24(["`#91;RSymbol#93; sum
|
|
220
235
|
(24, :may:36+)
|
|
221
236
|
*7.10-12*`"])
|
|
@@ -265,12 +280,18 @@ It offers a wide variety of features, for example:
|
|
|
265
280
|
(36)
|
|
266
281
|
*6.1-9.1*
|
|
267
282
|
(12, 20, 35)`"]]
|
|
283
|
+
built-in:for["`Built-In:
|
|
284
|
+
for`"]
|
|
285
|
+
style built-in:for stroke:gray,fill:lightgray,stroke-width:2px,opacity:.8;
|
|
268
286
|
38{{"`#91;RString#93; #34;Sum#58;#34;
|
|
269
287
|
(38)
|
|
270
288
|
*11.5-10*`"}}
|
|
271
289
|
40(["`#91;RSymbol#93; sum
|
|
272
290
|
(40)
|
|
273
291
|
*11.13-15*`"])
|
|
292
|
+
built-in:sum["`Built-In:
|
|
293
|
+
sum`"]
|
|
294
|
+
style built-in:sum stroke:gray,fill:lightgray,stroke-width:2px,opacity:.8;
|
|
274
295
|
42{{"`#91;RString#93; #34;
|
|
275
296
|
#34;
|
|
276
297
|
(42)
|
|
@@ -279,6 +300,9 @@ It offers a wide variety of features, for example:
|
|
|
279
300
|
(44)
|
|
280
301
|
*11.1-22*
|
|
281
302
|
(38, 40, 42)`"]]
|
|
303
|
+
built-in:cat["`Built-In:
|
|
304
|
+
cat`"]
|
|
305
|
+
style built-in:cat stroke:gray,fill:lightgray,stroke-width:2px,opacity:.8;
|
|
282
306
|
46{{"`#91;RString#93; #34;Product#58;#34;
|
|
283
307
|
(46)
|
|
284
308
|
*12.5-14*`"}}
|
|
@@ -297,87 +321,121 @@ It offers a wide variety of features, for example:
|
|
|
297
321
|
0 -->|"defined-by"| 2
|
|
298
322
|
2 -->|"argument"| 1
|
|
299
323
|
2 -->|"returns, argument"| 0
|
|
324
|
+
2 -.->|"reads, calls"| built-in:_-
|
|
325
|
+
linkStyle 4 stroke:gray;
|
|
300
326
|
3 -->|"defined-by"| 4
|
|
301
327
|
3 -->|"defined-by"| 5
|
|
302
328
|
5 -->|"argument"| 4
|
|
303
329
|
5 -->|"returns, argument"| 3
|
|
330
|
+
5 -.->|"reads, calls"| built-in:_-
|
|
331
|
+
linkStyle 9 stroke:gray;
|
|
304
332
|
6 -->|"defined-by"| 7
|
|
305
333
|
6 -->|"defined-by"| 8
|
|
306
334
|
8 -->|"argument"| 7
|
|
307
335
|
8 -->|"returns, argument"| 6
|
|
336
|
+
8 -.->|"reads, calls"| built-in:_-
|
|
337
|
+
linkStyle 14 stroke:gray;
|
|
308
338
|
9 -->|"defined-by"| 10
|
|
309
339
|
9 -->|"defined-by"| 11
|
|
310
340
|
11 -->|"argument"| 10
|
|
311
341
|
11 -->|"returns, argument"| 9
|
|
342
|
+
11 -.->|"reads, calls"| built-in:_-
|
|
343
|
+
linkStyle 19 stroke:gray;
|
|
312
344
|
12 -->|"defined-by"| 20
|
|
313
345
|
16 -->|"reads"| 9
|
|
314
346
|
18 -->|"reads, argument"| 16
|
|
315
347
|
18 -->|"reads, argument"| 17
|
|
348
|
+
18 -.->|"reads, calls"| built-in:-
|
|
349
|
+
linkStyle 24 stroke:gray;
|
|
316
350
|
19 -->|"returns, argument"| 18
|
|
351
|
+
19 -.->|"reads"| built-in:_
|
|
352
|
+
linkStyle 26 stroke:gray;
|
|
317
353
|
20 -->|"reads, argument"| 13
|
|
318
354
|
20 -->|"reads, argument"| 19
|
|
355
|
+
20 -.->|"reads, calls"| built-in::
|
|
356
|
+
linkStyle 29 stroke:gray;
|
|
319
357
|
24 -->|"reads"| 0
|
|
320
358
|
24 -->|"reads"| 23
|
|
321
359
|
24 -->|"CD-True"| 36
|
|
322
|
-
linkStyle
|
|
360
|
+
linkStyle 32 stroke:gray,color:gray;
|
|
323
361
|
25 -->|"reads"| 12
|
|
324
362
|
25 -->|"CD-True"| 36
|
|
325
|
-
linkStyle
|
|
363
|
+
linkStyle 34 stroke:gray,color:gray;
|
|
326
364
|
26 -->|"reads, argument"| 24
|
|
327
365
|
26 -->|"reads, argument"| 25
|
|
366
|
+
26 -.->|"reads, calls"| built-in:_
|
|
367
|
+
linkStyle 37 stroke:gray;
|
|
328
368
|
26 -->|"CD-True"| 36
|
|
329
|
-
linkStyle
|
|
369
|
+
linkStyle 38 stroke:gray,color:gray;
|
|
330
370
|
27 -->|"reads"| 6
|
|
331
371
|
27 -->|"CD-True"| 36
|
|
332
|
-
linkStyle
|
|
372
|
+
linkStyle 40 stroke:gray,color:gray;
|
|
333
373
|
28 -->|"reads, argument"| 26
|
|
334
374
|
28 -->|"reads, argument"| 27
|
|
375
|
+
28 -.->|"reads, calls"| built-in:_
|
|
376
|
+
linkStyle 43 stroke:gray;
|
|
335
377
|
28 -->|"CD-True"| 36
|
|
336
|
-
linkStyle
|
|
378
|
+
linkStyle 44 stroke:gray,color:gray;
|
|
337
379
|
23 -->|"defined-by"| 28
|
|
338
380
|
23 -->|"defined-by"| 29
|
|
339
381
|
29 -->|"argument"| 28
|
|
340
382
|
29 -->|"returns, argument"| 23
|
|
383
|
+
29 -.->|"reads, calls"| built-in:_-
|
|
384
|
+
linkStyle 49 stroke:gray;
|
|
341
385
|
29 -->|"CD-True"| 36
|
|
342
|
-
linkStyle
|
|
386
|
+
linkStyle 50 stroke:gray,color:gray;
|
|
343
387
|
31 -->|"reads"| 3
|
|
344
388
|
31 -->|"reads"| 30
|
|
345
389
|
31 -->|"CD-True"| 36
|
|
346
|
-
linkStyle
|
|
390
|
+
linkStyle 53 stroke:gray,color:gray;
|
|
347
391
|
32 -->|"reads"| 12
|
|
348
392
|
32 -->|"CD-True"| 36
|
|
349
|
-
linkStyle
|
|
393
|
+
linkStyle 55 stroke:gray,color:gray;
|
|
350
394
|
33 -->|"reads, argument"| 31
|
|
351
395
|
33 -->|"reads, argument"| 32
|
|
396
|
+
33 -.->|"reads, calls"| built-in:_
|
|
397
|
+
linkStyle 58 stroke:gray;
|
|
352
398
|
33 -->|"CD-True"| 36
|
|
353
|
-
linkStyle
|
|
399
|
+
linkStyle 59 stroke:gray,color:gray;
|
|
354
400
|
30 -->|"defined-by"| 33
|
|
355
401
|
30 -->|"defined-by"| 34
|
|
356
402
|
34 -->|"argument"| 33
|
|
357
403
|
34 -->|"returns, argument"| 30
|
|
404
|
+
34 -.->|"reads, calls"| built-in:_-
|
|
405
|
+
linkStyle 64 stroke:gray;
|
|
358
406
|
34 -->|"CD-True"| 36
|
|
359
|
-
linkStyle
|
|
407
|
+
linkStyle 65 stroke:gray,color:gray;
|
|
360
408
|
35 -->|"argument"| 29
|
|
361
409
|
35 -->|"returns, argument"| 34
|
|
410
|
+
35 -.->|"reads, calls"| built-in:_
|
|
411
|
+
linkStyle 68 stroke:gray;
|
|
362
412
|
35 -->|"CD-True"| 36
|
|
363
|
-
linkStyle
|
|
413
|
+
linkStyle 69 stroke:gray,color:gray;
|
|
364
414
|
36 -->|"reads, argument"| 12
|
|
365
415
|
36 -->|"reads, argument"| 20
|
|
366
416
|
36 -->|"argument, non-standard-evaluation"| 35
|
|
417
|
+
36 -.->|"reads, calls"| built-in:for
|
|
418
|
+
linkStyle 73 stroke:gray;
|
|
367
419
|
40 -->|"reads"| 0
|
|
368
420
|
40 -->|"reads"| 23
|
|
421
|
+
40 -.->|"reads"| built-in:sum
|
|
422
|
+
linkStyle 76 stroke:gray;
|
|
369
423
|
44 -->|"argument"| 38
|
|
370
424
|
44 -->|"reads, argument"| 40
|
|
371
425
|
44 -->|"argument"| 42
|
|
426
|
+
44 -.->|"reads, calls"| built-in:cat
|
|
427
|
+
linkStyle 80 stroke:gray;
|
|
372
428
|
48 -->|"reads"| 3
|
|
373
429
|
48 -->|"reads"| 30
|
|
374
430
|
52 -->|"argument"| 46
|
|
375
431
|
52 -->|"reads, argument"| 48
|
|
376
432
|
52 -->|"argument"| 50
|
|
433
|
+
52 -.->|"reads, calls"| built-in:cat
|
|
434
|
+
linkStyle 86 stroke:gray;
|
|
377
435
|
```
|
|
378
436
|
|
|
379
437
|
|
|
380
|
-
(The analysis required
|
|
438
|
+
(The analysis required _22.6 ms_ (including parse and normalize, using the [r-shell](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment.)
|
|
381
439
|
|
|
382
440
|
|
|
383
441
|
|
|
@@ -392,12 +450,16 @@ It offers a wide variety of features, for example:
|
|
|
392
450
|
|
|
393
451
|
If you want to use flowR and the features it provides, feel free to check out the:
|
|
394
452
|
|
|
395
|
-
- [Visual Studio Code
|
|
453
|
+
- [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr)/[Positron](https://open-vsx.org/extension/code-inspect/vscode-flowr): provides access to flowR directly in VS Code and Positron (or [vscode.dev](https://vscode.dev/))
|
|
396
454
|
- [RStudio Addin](https://github.com/flowr-analysis/rstudio-addin-flowr): integrates flowR into [RStudio](https://posit.co/downloads/)
|
|
397
455
|
- [R package](https://github.com/flowr-analysis/flowr-r-adapter): use flowR in your R scripts
|
|
398
456
|
- [Docker image](https://hub.docker.com/r/eagleoutice/flowr): run flowR in a container, this also includes [flowR's server](https://github.com/flowr-analysis/flowr/wiki/Interface#communicating-with-the-server)
|
|
399
457
|
- [NPM package](https://www.npmjs.com/package/@eagleoutice/flowr): include flowR in your TypeScript and JavaScript projects
|
|
400
458
|
|
|
459
|
+
|
|
460
|
+
If you are already using flowR and want to give feedback, please consider filling out our [feedback form](https://docs.google.com/forms/d/e/1FAIpQLScKFhgnh9LGVU7QzqLvFwZe1oiv_5jNhkIO-G-zND0ppqsMxQ/viewform).
|
|
461
|
+
|
|
462
|
+
|
|
401
463
|
## ⭐ Getting Started
|
|
402
464
|
|
|
403
465
|
To get started with _flowR_ and its features, please check out the [Overview](https://github.com/flowr-analysis/flowr/wiki/Overview) wiki page.
|
|
@@ -427,7 +489,7 @@ as well as the deployed [code documentation](https://flowr-analysis.github.io/fl
|
|
|
427
489
|
|
|
428
490
|
## 🚀 Contributing
|
|
429
491
|
|
|
430
|
-
We welcome every contribution! Please check out the [
|
|
492
|
+
We welcome every contribution! Please check out the [developer onboarding](https://github.com/flowr-analysis/flowr/wiki/Onboarding) section in the wiki for all the information you will need.
|
|
431
493
|
|
|
432
494
|
### Contributors
|
|
433
495
|
|
package/benchmark/slicer.d.ts
CHANGED
|
@@ -43,6 +43,13 @@ export interface BenchmarkSingleSliceStats extends MergeableRecord {
|
|
|
43
43
|
/** the final code, as the result of the 'reconstruct' step */
|
|
44
44
|
code: ReconstructionResult;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* The type of sampling strategy to use when slicing all possible variables.
|
|
48
|
+
*
|
|
49
|
+
* - `'random'`: Randomly select the given number of slicing criteria.
|
|
50
|
+
* - `'equidistant'`: Select the given number of slicing criteria in an equidistant manner.
|
|
51
|
+
*/
|
|
52
|
+
export type SamplingStrategy = 'random' | 'equidistant';
|
|
46
53
|
export declare class BenchmarkSlicer {
|
|
47
54
|
/** Measures all data recorded *once* per slicer (complete setup up to the dataflow graph creation) */
|
|
48
55
|
private readonly commonMeasurements;
|
|
@@ -62,38 +69,58 @@ export declare class BenchmarkSlicer {
|
|
|
62
69
|
* Initialize the slicer on the given request.
|
|
63
70
|
* Can only be called once for each instance.
|
|
64
71
|
*/
|
|
65
|
-
init(request: RParseRequestFromFile | RParseRequestFromText, autoSelectIf?: AutoSelectPredicate): Promise<void>;
|
|
72
|
+
init(request: RParseRequestFromFile | RParseRequestFromText, autoSelectIf?: AutoSelectPredicate, threshold?: number): Promise<void>;
|
|
66
73
|
private calculateStatsAfterInit;
|
|
67
74
|
/**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
* Counts the number of stored indices in the dataflow graph created by the pointer analysis.
|
|
76
|
+
*/
|
|
77
|
+
private countStoredVertexIndices;
|
|
78
|
+
/**
|
|
79
|
+
* Counts the number of stored indices in the dataflow graph created by the pointer analysis.
|
|
80
|
+
*/
|
|
81
|
+
private countStoredEnvIndices;
|
|
82
|
+
/**
|
|
83
|
+
* Counts the number of stored indices in the passed definitions.
|
|
84
|
+
*/
|
|
85
|
+
private countStoredIndices;
|
|
86
|
+
/**
|
|
87
|
+
* Recursively counts the number of indices and sub-indices in the given collection.
|
|
88
|
+
*/
|
|
89
|
+
private countIndices;
|
|
90
|
+
/**
|
|
91
|
+
* Slice for the given {@link SlicingCriteria}.
|
|
92
|
+
* @see SingleSlicingCriterion
|
|
93
|
+
*
|
|
94
|
+
* @returns The per slice stats retrieved for this slicing criteria
|
|
95
|
+
*/
|
|
73
96
|
slice(...slicingCriteria: SlicingCriteria): Promise<BenchmarkSingleSliceStats>;
|
|
74
97
|
/** Bridging the gap between the new internal and the old names for the benchmarking */
|
|
75
98
|
private measureCommonStep;
|
|
76
99
|
private measureSliceStep;
|
|
77
100
|
private guardActive;
|
|
78
101
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
sliceForAll(filter: SlicingCriteriaFilter, report?: (current: number, total: number, allCriteria: SlicingCriteria[]) => void,
|
|
102
|
+
* Call {@link slice} for all slicing criteria that match the given filter.
|
|
103
|
+
* See {@link collectAllSlicingCriteria} for details.
|
|
104
|
+
* <p>
|
|
105
|
+
* the `report` function will be called *before* each *individual* slice is performed.
|
|
106
|
+
*
|
|
107
|
+
* @returns The number of slices that were produced
|
|
108
|
+
*
|
|
109
|
+
* @see collectAllSlicingCriteria
|
|
110
|
+
* @see SlicingCriteriaFilter
|
|
111
|
+
*/
|
|
112
|
+
sliceForAll(filter: SlicingCriteriaFilter, report?: (current: number, total: number, allCriteria: SlicingCriteria[]) => void, options?: {
|
|
113
|
+
sampleCount?: number;
|
|
114
|
+
maxSliceCount?: number;
|
|
115
|
+
sampleStrategy?: SamplingStrategy;
|
|
116
|
+
}): Promise<number>;
|
|
90
117
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
118
|
+
* Retrieves the final stats and closes the shell session.
|
|
119
|
+
* Can be called multiple times to retrieve the stored stats, but will only close the session once (the first time).
|
|
120
|
+
*/
|
|
94
121
|
finish(): BenchmarkSlicerStats;
|
|
95
122
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
123
|
+
* Only call in case of an error - if the session must be closed and the benchmark itself is to be considered failed/dead.
|
|
124
|
+
*/
|
|
98
125
|
ensureSessionClosed(): void;
|
|
99
126
|
}
|
package/benchmark/slicer.js
CHANGED
|
@@ -12,7 +12,7 @@ const stopwatch_1 = require("./stopwatch");
|
|
|
12
12
|
const fs_1 = __importDefault(require("fs"));
|
|
13
13
|
const log_1 = require("../util/log");
|
|
14
14
|
const assert_1 = require("../util/assert");
|
|
15
|
-
const strings_1 = require("../util/strings");
|
|
15
|
+
const strings_1 = require("../util/text/strings");
|
|
16
16
|
const default_pipelines_1 = require("../core/steps/pipeline/default-pipelines");
|
|
17
17
|
const retriever_1 = require("../r-bridge/retriever");
|
|
18
18
|
const collect_all_1 = require("../slicing/criterion/collect-all");
|
|
@@ -22,6 +22,8 @@ const size_of_1 = require("./stats/size-of");
|
|
|
22
22
|
const shell_1 = require("../r-bridge/shell");
|
|
23
23
|
const tree_sitter_types_1 = require("../r-bridge/lang-4.x/tree-sitter/tree-sitter-types");
|
|
24
24
|
const tree_sitter_executor_1 = require("../r-bridge/lang-4.x/tree-sitter/tree-sitter-executor");
|
|
25
|
+
const vertex_1 = require("../dataflow/graph/vertex");
|
|
26
|
+
const arrays_1 = require("../util/collections/arrays");
|
|
25
27
|
/**
|
|
26
28
|
* The logger to be used for benchmarking as a global object.
|
|
27
29
|
*/
|
|
@@ -49,7 +51,7 @@ class BenchmarkSlicer {
|
|
|
49
51
|
* Initialize the slicer on the given request.
|
|
50
52
|
* Can only be called once for each instance.
|
|
51
53
|
*/
|
|
52
|
-
async init(request, autoSelectIf) {
|
|
54
|
+
async init(request, autoSelectIf, threshold) {
|
|
53
55
|
(0, assert_1.guard)(this.stats === undefined, 'cannot initialize the slicer twice');
|
|
54
56
|
// we know these are in sync so we just cast to one of them
|
|
55
57
|
this.parser = await this.commonMeasurements.measure('initialize R session', async () => {
|
|
@@ -64,7 +66,8 @@ class BenchmarkSlicer {
|
|
|
64
66
|
this.executor = (0, default_pipelines_1.createSlicePipeline)(this.parser, {
|
|
65
67
|
request: { ...request },
|
|
66
68
|
criterion: [],
|
|
67
|
-
autoSelectIf
|
|
69
|
+
autoSelectIf,
|
|
70
|
+
threshold,
|
|
68
71
|
});
|
|
69
72
|
this.loadedXml = (await this.measureCommonStep('parse', 'retrieve AST from R code')).parsed;
|
|
70
73
|
this.normalizedAst = await this.measureCommonStep('normalize', 'normalize R AST');
|
|
@@ -127,6 +130,9 @@ class BenchmarkSlicer {
|
|
|
127
130
|
}
|
|
128
131
|
return false;
|
|
129
132
|
});
|
|
133
|
+
const storedVertexIndices = this.countStoredVertexIndices();
|
|
134
|
+
const storedEnvIndices = this.countStoredEnvIndices();
|
|
135
|
+
const overwrittenIndices = storedVertexIndices - storedEnvIndices;
|
|
130
136
|
const split = loadedContent.split('\n');
|
|
131
137
|
const nonWhitespace = (0, strings_1.withoutWhitespace)(loadedContent).length;
|
|
132
138
|
this.stats = {
|
|
@@ -150,7 +156,10 @@ class BenchmarkSlicer {
|
|
|
150
156
|
numberOfEdges: numberOfEdges,
|
|
151
157
|
numberOfCalls: numberOfCalls,
|
|
152
158
|
numberOfFunctionDefinitions: numberOfDefinitions,
|
|
153
|
-
sizeOfObject: (0, size_of_1.getSizeOfDfGraph)(this.dataflow.graph)
|
|
159
|
+
sizeOfObject: (0, size_of_1.getSizeOfDfGraph)(this.dataflow.graph),
|
|
160
|
+
storedVertexIndices: storedVertexIndices,
|
|
161
|
+
storedEnvIndices: storedEnvIndices,
|
|
162
|
+
overwrittenIndices: overwrittenIndices,
|
|
154
163
|
},
|
|
155
164
|
// these are all properly initialized in finish()
|
|
156
165
|
commonMeasurements: new Map(),
|
|
@@ -161,11 +170,52 @@ class BenchmarkSlicer {
|
|
|
161
170
|
};
|
|
162
171
|
}
|
|
163
172
|
/**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
* Counts the number of stored indices in the dataflow graph created by the pointer analysis.
|
|
174
|
+
*/
|
|
175
|
+
countStoredVertexIndices() {
|
|
176
|
+
return this.countStoredIndices(this.dataflow?.out.map(ref => ref) ?? []);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Counts the number of stored indices in the dataflow graph created by the pointer analysis.
|
|
180
|
+
*/
|
|
181
|
+
countStoredEnvIndices() {
|
|
182
|
+
return this.countStoredIndices(this.dataflow?.environment.current.memory.values()
|
|
183
|
+
?.flatMap(def => def)
|
|
184
|
+
.map(def => def) ?? []);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Counts the number of stored indices in the passed definitions.
|
|
188
|
+
*/
|
|
189
|
+
countStoredIndices(definitions) {
|
|
190
|
+
let numberOfIndices = 0;
|
|
191
|
+
for (const reference of definitions) {
|
|
192
|
+
if (reference.indicesCollection) {
|
|
193
|
+
numberOfIndices += this.countIndices(reference.indicesCollection);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return numberOfIndices;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Recursively counts the number of indices and sub-indices in the given collection.
|
|
200
|
+
*/
|
|
201
|
+
countIndices(collection) {
|
|
202
|
+
let numberOfIndices = 0;
|
|
203
|
+
for (const indices of collection ?? []) {
|
|
204
|
+
for (const index of indices.indices) {
|
|
205
|
+
numberOfIndices++;
|
|
206
|
+
if ((0, vertex_1.isParentContainerIndex)(index)) {
|
|
207
|
+
numberOfIndices += this.countIndices(index.subIndices);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return numberOfIndices;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Slice for the given {@link SlicingCriteria}.
|
|
215
|
+
* @see SingleSlicingCriterion
|
|
216
|
+
*
|
|
217
|
+
* @returns The per slice stats retrieved for this slicing criteria
|
|
218
|
+
*/
|
|
169
219
|
async slice(...slicingCriteria) {
|
|
170
220
|
exports.benchmarkLogger.trace(`try to slice for criteria ${JSON.stringify(slicingCriteria)}`);
|
|
171
221
|
this.guardActive();
|
|
@@ -227,23 +277,33 @@ class BenchmarkSlicer {
|
|
|
227
277
|
(0, assert_1.guard)(this.stats !== undefined && !this.finished, 'need to call init before, and can not do after finish!');
|
|
228
278
|
}
|
|
229
279
|
/**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
async sliceForAll(filter, report = () => { },
|
|
280
|
+
* Call {@link slice} for all slicing criteria that match the given filter.
|
|
281
|
+
* See {@link collectAllSlicingCriteria} for details.
|
|
282
|
+
* <p>
|
|
283
|
+
* the `report` function will be called *before* each *individual* slice is performed.
|
|
284
|
+
*
|
|
285
|
+
* @returns The number of slices that were produced
|
|
286
|
+
*
|
|
287
|
+
* @see collectAllSlicingCriteria
|
|
288
|
+
* @see SlicingCriteriaFilter
|
|
289
|
+
*/
|
|
290
|
+
async sliceForAll(filter, report = () => { }, options = {}) {
|
|
291
|
+
const { sampleCount, maxSliceCount, sampleStrategy } = { sampleCount: -1, maxSliceCount: -1, sampleStrategy: 'random', ...options };
|
|
241
292
|
this.guardActive();
|
|
242
293
|
let count = 0;
|
|
243
|
-
|
|
244
|
-
if
|
|
245
|
-
|
|
246
|
-
|
|
294
|
+
let allCriteria = [...(0, collect_all_1.collectAllSlicingCriteria)(this.normalizedAst.ast, filter)];
|
|
295
|
+
// Cancel slicing if the number of slices exceeds the limit
|
|
296
|
+
if (maxSliceCount > 0 && allCriteria.length > maxSliceCount) {
|
|
297
|
+
return -allCriteria.length;
|
|
298
|
+
}
|
|
299
|
+
if (sampleCount > 0) {
|
|
300
|
+
if (sampleStrategy === 'equidistant') {
|
|
301
|
+
allCriteria = (0, arrays_1.equidistantSampling)(allCriteria, sampleCount, 'ceil');
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
allCriteria.sort(() => Math.random() - 0.5);
|
|
305
|
+
allCriteria.length = Math.min(allCriteria.length, sampleCount);
|
|
306
|
+
}
|
|
247
307
|
}
|
|
248
308
|
for (const slicingCriteria of allCriteria) {
|
|
249
309
|
report(count, allCriteria.length, allCriteria);
|
|
@@ -253,9 +313,9 @@ class BenchmarkSlicer {
|
|
|
253
313
|
return count;
|
|
254
314
|
}
|
|
255
315
|
/**
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
316
|
+
* Retrieves the final stats and closes the shell session.
|
|
317
|
+
* Can be called multiple times to retrieve the stored stats, but will only close the session once (the first time).
|
|
318
|
+
*/
|
|
259
319
|
finish() {
|
|
260
320
|
(0, assert_1.guard)(this.stats !== undefined, 'need to call init before finish');
|
|
261
321
|
if (!this.finished) {
|
|
@@ -291,8 +351,8 @@ class BenchmarkSlicer {
|
|
|
291
351
|
};
|
|
292
352
|
}
|
|
293
353
|
/**
|
|
294
|
-
|
|
295
|
-
|
|
354
|
+
* Only call in case of an error - if the session must be closed and the benchmark itself is to be considered failed/dead.
|
|
355
|
+
*/
|
|
296
356
|
ensureSessionClosed() {
|
|
297
357
|
this.parser?.close();
|
|
298
358
|
}
|
package/benchmark/stats/print.js
CHANGED
|
@@ -140,11 +140,14 @@ Input:
|
|
|
140
140
|
Normalized R tokens (w/o comments): ${pad(stats.input.numberOfNormalizedTokensNoComments)}
|
|
141
141
|
|
|
142
142
|
Dataflow:
|
|
143
|
-
Number of nodes:
|
|
144
|
-
Number of edges:
|
|
145
|
-
Number of calls:
|
|
146
|
-
Number of function defs:
|
|
147
|
-
|
|
143
|
+
Number of nodes: ${pad(stats.dataflow.numberOfNodes)}
|
|
144
|
+
Number of edges: ${pad(stats.dataflow.numberOfEdges)}
|
|
145
|
+
Number of calls: ${pad(stats.dataflow.numberOfCalls)}
|
|
146
|
+
Number of function defs: ${pad(stats.dataflow.numberOfFunctionDefinitions)}
|
|
147
|
+
Number of stored Vtx indices: ${pad(stats.dataflow.storedVertexIndices)}
|
|
148
|
+
Number of stored Env indices: ${pad(stats.dataflow.storedEnvIndices)}
|
|
149
|
+
Number of overwritten indices: ${pad(stats.dataflow.overwrittenIndices)}
|
|
150
|
+
Size of graph: ${convertNumberToNiceBytes(stats.dataflow.sizeOfObject)}`;
|
|
148
151
|
}
|
|
149
152
|
function ultimateStats2String(stats) {
|
|
150
153
|
const slice = stats.totalSlices > 0 ? `Slice summary for:
|
|
@@ -195,11 +198,14 @@ Input:
|
|
|
195
198
|
Normalized R tokens (w/o comments): ${formatSummarizedMeasure(stats.input.numberOfNormalizedTokensNoComments)}
|
|
196
199
|
|
|
197
200
|
Dataflow:
|
|
198
|
-
Number of nodes:
|
|
199
|
-
Number of edges:
|
|
200
|
-
Number of calls:
|
|
201
|
-
Number of function defs:
|
|
202
|
-
|
|
201
|
+
Number of nodes: ${formatSummarizedMeasure(stats.dataflow.numberOfNodes)}
|
|
202
|
+
Number of edges: ${formatSummarizedMeasure(stats.dataflow.numberOfEdges)}
|
|
203
|
+
Number of calls: ${formatSummarizedMeasure(stats.dataflow.numberOfCalls)}
|
|
204
|
+
Number of function defs: ${formatSummarizedMeasure(stats.dataflow.numberOfFunctionDefinitions)}
|
|
205
|
+
Number of stored Vtx indices: ${formatSummarizedMeasure(stats.dataflow.storedVertexIndices)}
|
|
206
|
+
Number of stored Env indices: ${formatSummarizedMeasure(stats.dataflow.storedEnvIndices)}
|
|
207
|
+
Number of overwritten indices: ${formatSummarizedMeasure(stats.dataflow.overwrittenIndices)}
|
|
208
|
+
Size of graph: ${formatSummarizedMeasure(stats.dataflow.sizeOfObject, convertNumberToNiceBytes)}
|
|
203
209
|
`;
|
|
204
210
|
}
|
|
205
211
|
function reduction2String(title, reduction) {
|
|
@@ -65,6 +65,23 @@ function getSizeOfDfGraph(df) {
|
|
|
65
65
|
});
|
|
66
66
|
verts.push(vertex);
|
|
67
67
|
}
|
|
68
|
-
return (
|
|
68
|
+
return safeSizeOf([...verts, ...df.edges()]);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Calculates the size of an array in bytes.
|
|
72
|
+
*
|
|
73
|
+
* @param array - The array to calculate the size of.
|
|
74
|
+
* @returns The size of the array in bytes.
|
|
75
|
+
*/
|
|
76
|
+
function safeSizeOf(array) {
|
|
77
|
+
const size = (0, object_sizeof_1.default)(array);
|
|
78
|
+
if (typeof size === 'number') {
|
|
79
|
+
return size;
|
|
80
|
+
}
|
|
81
|
+
// the sizeOf method returns an error object, when the size could not be calculated
|
|
82
|
+
// in this case, we split the array in half and calculate the size of each half recursively
|
|
83
|
+
const chunkSize = Math.ceil(array.length / 2);
|
|
84
|
+
// subtract 1, because of the separate stringification of the array
|
|
85
|
+
return safeSizeOf(array.slice(0, chunkSize)) + safeSizeOf(array.slice(chunkSize)) - 1;
|
|
69
86
|
}
|
|
70
87
|
//# sourceMappingURL=size-of.js.map
|
|
@@ -37,6 +37,9 @@ export interface SlicerStatsDataflow<T = number> {
|
|
|
37
37
|
numberOfCalls: T;
|
|
38
38
|
numberOfFunctionDefinitions: T;
|
|
39
39
|
sizeOfObject: T;
|
|
40
|
+
storedVertexIndices: T;
|
|
41
|
+
storedEnvIndices: T;
|
|
42
|
+
overwrittenIndices: T;
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
45
|
* Please note, that these measurement can be negative as there is no guarantee that the memory usage will increase
|
|
@@ -9,7 +9,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const process_1 = require("../second-phase/process");
|
|
10
10
|
const process_2 = require("./process");
|
|
11
11
|
const assert_1 = require("../../../util/assert");
|
|
12
|
-
const ansi_1 = require("../../../util/ansi");
|
|
12
|
+
const ansi_1 = require("../../../util/text/ansi");
|
|
13
13
|
const json_1 = require("../../../util/json");
|
|
14
14
|
const print_1 = require("../../stats/print");
|
|
15
15
|
async function processRunMeasurement(line, fileNum, lineNum, textOutputAppendPath, rawOutputPath) {
|