@eagleoutice/flowr 2.14.0 → 2.14.1

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.
Files changed (96) hide show
  1. package/README.md +39 -28
  2. package/benchmark/calibration.d.ts +13 -11
  3. package/benchmark/calibration.js +25 -26
  4. package/benchmark/slicer.d.ts +2 -1
  5. package/benchmark/slicer.js +6 -3
  6. package/cli/benchmark-app.js +4 -1
  7. package/cli/benchmark-helper-app.d.ts +1 -0
  8. package/cli/benchmark-helper-app.js +2 -2
  9. package/cli/common/options.d.ts +5 -0
  10. package/cli/common/options.js +1 -0
  11. package/cli/common/scripts-info.d.ts +5 -0
  12. package/cli/repl/execute.d.ts +2 -2
  13. package/cli/repl/execute.js +2 -2
  14. package/config.js +5 -6
  15. package/dataflow/environments/apply-kill.js +1 -1
  16. package/dataflow/environments/built-in-props.d.ts +6 -2
  17. package/dataflow/environments/built-in-props.js +5 -1
  18. package/dataflow/environments/default-builtin-config.d.ts +76 -1
  19. package/dataflow/environments/default-builtin-config.js +30 -5
  20. package/dataflow/environments/environment.d.ts +9 -1
  21. package/dataflow/environments/environment.js +25 -7
  22. package/dataflow/environments/identifier.d.ts +1 -0
  23. package/dataflow/environments/query-fn-props.d.ts +6 -0
  24. package/dataflow/environments/query-fn-props.js +20 -0
  25. package/dataflow/environments/resolve-by-name.js +14 -2
  26. package/dataflow/eval/resolve/resolve-operators.js +1 -1
  27. package/dataflow/eval/resolve/resolve-working-directory.d.ts +1 -1
  28. package/dataflow/eval/resolve/resolve-working-directory.js +1 -2
  29. package/dataflow/fn/exceptions-of-function.d.ts +3 -1
  30. package/dataflow/fn/exceptions-of-function.js +85 -38
  31. package/dataflow/fn/strict-function.d.ts +40 -0
  32. package/dataflow/fn/strict-function.js +337 -0
  33. package/dataflow/graph/df-helper.d.ts +9 -1
  34. package/dataflow/graph/df-helper.js +19 -3
  35. package/dataflow/graph/graph.d.ts +28 -2
  36. package/dataflow/graph/graph.js +59 -2
  37. package/dataflow/info.d.ts +26 -0
  38. package/dataflow/info.js +28 -1
  39. package/dataflow/internal/process/functions/call/built-in/built-in-rm.d.ts +1 -0
  40. package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +27 -1
  41. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  42. package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +29 -8
  43. package/documentation/wiki-core.js +1 -1
  44. package/documentation/wiki-dataflow-graph.js +1 -0
  45. package/documentation/wiki-linter.js +1 -0
  46. package/documentation/wiki-query.js +53 -0
  47. package/linter/linter-output.js +1 -1
  48. package/linter/linter-rules.d.ts +24 -0
  49. package/linter/linter-rules.js +3 -1
  50. package/linter/rules/network-functions.d.ts +1 -1
  51. package/linter/rules/unclosed-connection.d.ts +44 -0
  52. package/linter/rules/unclosed-connection.js +200 -0
  53. package/package.json +4 -7
  54. package/project/dependency-version-space.d.ts +3 -3
  55. package/project/dependency-version-space.js +2 -2
  56. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
  57. package/project/plugins/file-plugins/files/flowr-description-file.js +1 -1
  58. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
  59. package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
  60. package/project/plugins/file-plugins/files/flowr-news-file.d.ts +1 -1
  61. package/project/plugins/file-plugins/files/flowr-news-file.js +1 -1
  62. package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +1 -1
  63. package/project/plugins/file-plugins/files/flowr-rda-file.js +1 -1
  64. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +5 -5
  65. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +33 -6
  66. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
  67. package/project/sigdb/manifest.d.ts +3 -1
  68. package/project/sigdb/manifest.js +50 -9
  69. package/project/sigdb/reader.js +1 -1
  70. package/project/sigdb/schema.d.ts +2 -2
  71. package/project/sigdb/schema.js +2 -2
  72. package/queries/catalog/dependencies-query/link-devices.js +2 -8
  73. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -1
  74. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +1 -0
  75. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.d.ts +6 -0
  76. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-executor.js +25 -0
  77. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.d.ts +31 -0
  78. package/queries/catalog/inspect-strictness-query/inspect-strictness-query-format.js +56 -0
  79. package/queries/catalog/slice-query-options.d.ts +1 -1
  80. package/queries/catalog/slice-query-options.js +1 -1
  81. package/queries/query-function-filter.d.ts +8 -2
  82. package/queries/query-function-filter.js +11 -1
  83. package/queries/query.d.ts +11 -1
  84. package/queries/query.js +2 -0
  85. package/r-bridge/lang-4.x/ast/model/model.d.ts +4 -4
  86. package/r-bridge/lang-4.x/ast/model/model.js +4 -4
  87. package/search/flowr-search-filters.js +1 -13
  88. package/slicing/criterion/parse.d.ts +2 -2
  89. package/slicing/criterion/parse.js +2 -2
  90. package/slicing/static/fingerprint.js +1 -1
  91. package/util/objects.d.ts +12 -0
  92. package/util/objects.js +48 -0
  93. package/util/simple-df/dfg-ascii.js +14 -3
  94. package/util/text/name-rank.d.ts +1 -1
  95. package/util/text/name-rank.js +1 -1
  96. package/util/version.js +1 -1
package/README.md CHANGED
@@ -43,7 +43,7 @@ It offers a wide variety of features, for example:
43
43
 
44
44
  ```shell
45
45
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
46
- flowR repl v2.13.16, R grammar v14 (tree-sitter engine)
46
+ flowR repl v2.14.0, R grammar v14 (tree-sitter engine)
47
47
  R> :query @linter "read.csv(\"/root/x.txt\")"
48
48
  ```
49
49
 
@@ -52,7 +52,7 @@ It offers a wide variety of features, for example:
52
52
 
53
53
 
54
54
  ```text
55
- Query: linter (66 ms)
55
+ Query: linter (7 ms)
56
56
  ╰ Deprecated Functions (deprecated-functions): no findings
57
57
  ╰ File Path Validity (file-path-validity): no findings
58
58
  ╰ Seeded Randomness (seeded-randomness): no findings
@@ -67,7 +67,8 @@ It offers a wide variety of features, for example:
67
67
  ╰ Roxygen Arguments (roxygen-arguments): no findings
68
68
  ╰ No Leaked Credentials (no-leaked-credentials): no findings
69
69
  ╰ Undefined Symbol (undefined-symbol): no findings
70
- All queries together required ≈66 ms (1ms accuracy, total 67 ms)
70
+ ╰ Unclosed Connection (unclosed-connection): no findings
71
+ All queries together required ≈7 ms (1ms accuracy, total 7 ms)
71
72
  ```
72
73
 
73
74
 
@@ -89,17 +90,17 @@ It offers a wide variety of features, for example:
89
90
 
90
91
  _Results (prettified and summarized):_
91
92
 
92
- Query: **linter** (473 ms)\
93
+ Query: **linter** (15 ms)\
93
94
     ╰ **Deprecated Functions** (deprecated-functions): _no findings_\
94
95
     ╰ **File Path Validity** (file-path-validity):\
95
96
         ╰ certain:\
96
97
             ╰ Path `/root/x.txt` at 1.1-23\
97
-        ╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 5, processTimeMs: 2\
98
+        ╰ _Metadata_: totalReads: 1, totalUnknown: 0, totalWritesBeforeAlways: 0, totalValid: 0, searchTimeMs: 1, processTimeMs: 1\
98
99
     ╰ **Seeded Randomness** (seeded-randomness): _no findings_\
99
100
     ╰ **Absolute Paths** (absolute-file-paths):\
100
101
         ╰ certain:\
101
102
             ╰ Path `/root/x.txt` at 1.1-23\
102
-        ╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 2, processTimeMs: 0\
103
+        ╰ _Metadata_: totalConsidered: 1, totalUnknown: 0, searchTimeMs: 1, processTimeMs: 0\
103
104
     ╰ **Unused Definitions** (unused-definitions): _no findings_\
104
105
     ╰ **Network Functions** (network-functions): _no findings_\
105
106
     ╰ **Dataframe Access Validation** (dataframe-access-validation): _no findings_\
@@ -110,11 +111,12 @@ It offers a wide variety of features, for example:
110
111
     ╰ **Roxygen Arguments** (roxygen-arguments): _no findings_\
111
112
     ╰ **No Leaked Credentials** (no-leaked-credentials): _no findings_\
112
113
     ╰ **Undefined Symbol** (undefined-symbol): _no findings_\
113
- _All queries together required ≈473 ms (1ms accuracy, total 479 ms)_
114
+    ╰ **Unclosed Connection** (unclosed-connection): _no findings_\
115
+ _All queries together required ≈15 ms (1ms accuracy, total 16 ms)_
114
116
 
115
117
  <details> <summary style="color:gray">Show Detailed Results as Json</summary>
116
118
 
117
- The analysis required _479.0 ms_ (including parsing and normalization and the query) within the generation environment.
119
+ The analysis required _16.3 ms_ (including parsing and normalization and the query) within the generation environment.
118
120
 
119
121
  In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR.
120
122
  Please consult the [Interface](https://github.com/flowr-analysis/flowr/wiki/Interface) wiki page for more information on how to get those.
@@ -131,8 +133,8 @@ It offers a wide variety of features, for example:
131
133
  ".meta": {
132
134
  "totalCalls": 0,
133
135
  "totalFunctionDefinitions": 0,
134
- "searchTimeMs": 112,
135
- "processTimeMs": 293
136
+ "searchTimeMs": 2,
137
+ "processTimeMs": 4
136
138
  }
137
139
  },
138
140
  "file-path-validity": {
@@ -154,8 +156,8 @@ It offers a wide variety of features, for example:
154
156
  "totalUnknown": 0,
155
157
  "totalWritesBeforeAlways": 0,
156
158
  "totalValid": 0,
157
- "searchTimeMs": 5,
158
- "processTimeMs": 2
159
+ "searchTimeMs": 1,
160
+ "processTimeMs": 1
159
161
  }
160
162
  },
161
163
  "seeded-randomness": {
@@ -186,7 +188,7 @@ It offers a wide variety of features, for example:
186
188
  ".meta": {
187
189
  "totalConsidered": 1,
188
190
  "totalUnknown": 0,
189
- "searchTimeMs": 2,
191
+ "searchTimeMs": 1,
190
192
  "processTimeMs": 0
191
193
  }
192
194
  },
@@ -195,7 +197,7 @@ It offers a wide variety of features, for example:
195
197
  ".meta": {
196
198
  "totalConsidered": 0,
197
199
  "searchTimeMs": 0,
198
- "processTimeMs": 1
200
+ "processTimeMs": 0
199
201
  }
200
202
  },
201
203
  "network-functions": {
@@ -204,7 +206,7 @@ It offers a wide variety of features, for example:
204
206
  "totalCalls": 0,
205
207
  "totalFunctionDefinitions": 0,
206
208
  "searchTimeMs": 1,
207
- "processTimeMs": 2
209
+ "processTimeMs": 0
208
210
  }
209
211
  },
210
212
  "dataframe-access-validation": {
@@ -214,13 +216,13 @@ It offers a wide variety of features, for example:
214
216
  "numAccesses": 0,
215
217
  "totalAccessed": 0,
216
218
  "searchTimeMs": 0,
217
- "processTimeMs": 7
219
+ "processTimeMs": 1
218
220
  }
219
221
  },
220
222
  "dead-code": {
221
223
  "results": [],
222
224
  ".meta": {
223
- "searchTimeMs": 1,
225
+ "searchTimeMs": 0,
224
226
  "processTimeMs": 0
225
227
  }
226
228
  },
@@ -228,15 +230,15 @@ It offers a wide variety of features, for example:
228
230
  "results": [],
229
231
  ".meta": {
230
232
  "numOfUselessLoops": 0,
231
- "searchTimeMs": 1,
232
- "processTimeMs": 0
233
+ "searchTimeMs": 0,
234
+ "processTimeMs": 1
233
235
  }
234
236
  },
235
237
  "problematic-inputs": {
236
238
  "results": [],
237
239
  ".meta": {
238
240
  "searchTimeMs": 0,
239
- "processTimeMs": 1
241
+ "processTimeMs": 0
240
242
  }
241
243
  },
242
244
  "stop-call": {
@@ -275,16 +277,25 @@ It offers a wide variety of features, for example:
275
277
  "subscript": 0
276
278
  },
277
279
  "searchTimeMs": 0,
278
- "processTimeMs": 40
280
+ "processTimeMs": 2
281
+ }
282
+ },
283
+ "unclosed-connection": {
284
+ "results": [],
285
+ ".meta": {
286
+ "totalOpened": 0,
287
+ "totalClosed": 0,
288
+ "searchTimeMs": 0,
289
+ "processTimeMs": 0
279
290
  }
280
291
  }
281
292
  },
282
293
  ".meta": {
283
- "timing": 473
294
+ "timing": 15
284
295
  }
285
296
  },
286
297
  ".meta": {
287
- "timing": 473
298
+ "timing": 15
288
299
  }
289
300
  }
290
301
  ```
@@ -348,7 +359,7 @@ It offers a wide variety of features, for example:
348
359
 
349
360
  ```shell
350
361
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
351
- flowR repl v2.13.16, R grammar v14 (tree-sitter engine)
362
+ flowR repl v2.14.0, R grammar v14 (tree-sitter engine)
352
363
  R> :query @static-slice (11@sum) file://test/testfiles/example.R
353
364
  ```
354
365
 
@@ -362,7 +373,7 @@ It offers a wide variety of features, for example:
362
373
  N <- 10
363
374
  for(i in 1:(N-1)) sum <- sum + i + w
364
375
  sum
365
- All queries together required ≈30 ms (1ms accuracy, total 31 ms)
376
+ All queries together required ≈5 ms (1ms accuracy, total 5 ms)
366
377
  ```
367
378
 
368
379
 
@@ -377,7 +388,7 @@ It offers a wide variety of features, for example:
377
388
  </details>
378
389
 
379
390
  * 🚀 **fast call-graph, data-, and control-flow graphs**\
380
- Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">105.6 ms</span></i> (as of Aug 14, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
391
+ Within just [<i><span title="This measurement is automatically fetched from the latest benchmark!">108.9 ms</span></i> (as of Aug 18, 2026)](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark),
381
392
  _flowR_ can analyze the data- and control-flow of the average real-world R&nbsp;script. See the [benchmarks](https://flowr-analysis.github.io/flowr/wiki/stats/benchmark) for more information,
382
393
  and consult the [wiki pages](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) for more details on the [dataflow graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph) as well as [call graphs](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#perspectives-cg).
383
394
 
@@ -413,7 +424,7 @@ It offers a wide variety of features, for example:
413
424
 
414
425
  ```shell
415
426
  $ docker run -it --rm eagleoutice/flowr # or npm run flowr
416
- flowR repl v2.13.16, R grammar v14 (tree-sitter engine)
427
+ flowR repl v2.14.0, R grammar v14 (tree-sitter engine)
417
428
  R> :dataflow* test/testfiles/example.R
418
429
  ```
419
430
 
@@ -686,7 +697,7 @@ It offers a wide variety of features, for example:
686
697
  ```
687
698
 
688
699
 
689
- (The analysis required _4.4 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
700
+ (The analysis required _3.3 ms_ (including parse and normalize, using the [tree-sitter](https://github.com/flowr-analysis/flowr/wiki/Engines) engine) within the generation environment. No [signature database](https://github.com/flowr-analysis/flowr/wiki/Signature-Database) is mounted for these generated graphs, so `library()` calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. `acf` as `stats::acf`).)
690
701
 
691
702
 
692
703
 
@@ -3,22 +3,24 @@
3
3
  *
4
4
  * Publishing its runtime alongside the real measurements allows a viewer to normalize the other numbers by it,
5
5
  * and hence to cancel out how fast or how loaded the machine was that produced them.
6
- * The workload must therefore stay deterministic (no file system, no R session, no randomness)
7
- * and cheap (well below a second).
6
+ * The workload must therefore stay deterministic (no file system, no R session, no randomness).
7
+ *
8
+ * Changing the work, the round count, or the way the repetitions are reduced puts every future run on a
9
+ * new scale, incomparable to the published history. Whoever changes it has to say so in the name of the
10
+ * measurement (`calibration v2`, ...).
8
11
  * @module
9
12
  */
10
- /** How often the {@link calibrationRound} is timed within one {@link runCalibration} call. */
11
- export declare const CalibrationReps = 6;
13
+ /** How often the {@link calibrationBatch} is timed within one {@link runCalibration} call. */
14
+ export declare const CalibrationReps = 4;
15
+ /** How many files of a suite carry the calibration, which describes the machine and not the file. */
16
+ export declare const CalibrationSamples = 8;
17
+ /** How many {@link calibrationRound}s make up one timed batch. */
18
+ export declare const CalibrationRounds = 256;
12
19
  /** How many elements a single {@link calibrationRound} works on. */
13
20
  export declare const CalibrationSize = 4096;
14
21
  /**
15
- * Times {@link calibrationRound} {@link CalibrationReps} times and reports the fastest of them.
16
- *
17
- * The first round is thrown away: it pays for compiling the workload and would describe the engine
18
- * rather than the machine. Of the rounds that follow, only the fastest counts, because every
19
- * disturbance a shared runner can add (another job, a scheduler switch, a collection) can only ever
20
- * make a round slower. That makes the number a statement about the machine, not about its bad luck.
21
- * @returns the nanoseconds the fastest round took
22
+ * Times {@link calibrationBatch} {@link CalibrationReps} times and reports the fastest of them.
23
+ * @returns the nanoseconds the fastest batch took
22
24
  */
23
25
  export declare function runCalibration(): bigint;
24
26
  /** the checksum of the rounds run so far, only exposed so that the workload has an observable effect */
@@ -4,43 +4,40 @@
4
4
  *
5
5
  * Publishing its runtime alongside the real measurements allows a viewer to normalize the other numbers by it,
6
6
  * and hence to cancel out how fast or how loaded the machine was that produced them.
7
- * The workload must therefore stay deterministic (no file system, no R session, no randomness)
8
- * and cheap (well below a second).
7
+ * The workload must therefore stay deterministic (no file system, no R session, no randomness).
8
+ *
9
+ * Changing the work, the round count, or the way the repetitions are reduced puts every future run on a
10
+ * new scale, incomparable to the published history. Whoever changes it has to say so in the name of the
11
+ * measurement (`calibration v2`, ...).
9
12
  * @module
10
13
  */
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CalibrationSize = exports.CalibrationReps = void 0;
15
+ exports.CalibrationSize = exports.CalibrationRounds = exports.CalibrationSamples = exports.CalibrationReps = void 0;
13
16
  exports.runCalibration = runCalibration;
14
17
  exports.calibrationChecksum = calibrationChecksum;
15
- /** How often the {@link calibrationRound} is timed within one {@link runCalibration} call. */
16
- exports.CalibrationReps = 6;
18
+ /** How often the {@link calibrationBatch} is timed within one {@link runCalibration} call. */
19
+ exports.CalibrationReps = 4;
20
+ /** How many files of a suite carry the calibration, which describes the machine and not the file. */
21
+ exports.CalibrationSamples = 8;
22
+ /** How many {@link calibrationRound}s make up one timed batch. */
23
+ exports.CalibrationRounds = 256;
17
24
  /** How many elements a single {@link calibrationRound} works on. */
18
25
  exports.CalibrationSize = 4096;
19
- /** the checksums land here, so that no engine can decide the workload has no effect and drop it */
20
26
  let sink = 0;
21
- /** xorshift32 with a fixed seed so that every round does the exact same work */
22
27
  function nextRandom(state) {
23
28
  state ^= state << 13;
24
29
  state ^= state >>> 17;
25
30
  state ^= state << 5;
26
31
  return state | 0;
27
32
  }
28
- /**
29
- * One round of the calibration workload, mixing integer arithmetic, array sorting, string handling,
30
- * short-lived objects, and map lookups to cover the operations that dominate the analysis itself.
31
- *
32
- * Every round does the very same work, which is what allows {@link runCalibration} to compare its repetitions.
33
- * @returns a checksum, only returned so that the work cannot be optimized away
34
- */
35
- function calibrationRound() {
36
- let state = 0x1337;
33
+ function calibrationRound(round) {
34
+ let state = 0x1337 + round;
37
35
  const numbers = new Array(exports.CalibrationSize);
38
36
  for (let i = 0; i < exports.CalibrationSize; i++) {
39
37
  state = nextRandom(state);
40
38
  numbers[i] = state % 100_000;
41
39
  }
42
40
  numbers.sort((a, b) => a - b);
43
- /* the analysis spends most of its time on small objects that die young, so the workload allocates some too */
44
41
  const nodes = [];
45
42
  const map = new Map();
46
43
  const seen = new Set();
@@ -62,21 +59,23 @@ function calibrationRound() {
62
59
  }
63
60
  return checksum;
64
61
  }
62
+ function calibrationBatch() {
63
+ let checksum = 0;
64
+ for (let round = 0; round < exports.CalibrationRounds; round++) {
65
+ checksum = (checksum + calibrationRound(round)) | 0;
66
+ }
67
+ return checksum;
68
+ }
65
69
  /**
66
- * Times {@link calibrationRound} {@link CalibrationReps} times and reports the fastest of them.
67
- *
68
- * The first round is thrown away: it pays for compiling the workload and would describe the engine
69
- * rather than the machine. Of the rounds that follow, only the fastest counts, because every
70
- * disturbance a shared runner can add (another job, a scheduler switch, a collection) can only ever
71
- * make a round slower. That makes the number a statement about the machine, not about its bad luck.
72
- * @returns the nanoseconds the fastest round took
70
+ * Times {@link calibrationBatch} {@link CalibrationReps} times and reports the fastest of them.
71
+ * @returns the nanoseconds the fastest batch took
73
72
  */
74
73
  function runCalibration() {
75
- sink = calibrationRound();
74
+ sink = calibrationRound(0);
76
75
  let best = undefined;
77
76
  for (let rep = 0; rep < exports.CalibrationReps; rep++) {
78
77
  const start = process.hrtime.bigint();
79
- sink = (sink + calibrationRound()) | 0;
78
+ sink = (sink + calibrationBatch()) | 0;
80
79
  const took = process.hrtime.bigint() - start;
81
80
  if (best === undefined || took < best) {
82
81
  best = took;
@@ -102,8 +102,9 @@ export declare class BenchmarkSlicer {
102
102
  * These run *after* all other steps and are excluded from the {@link CommonSlicerMeasurements} (and hence from
103
103
  * the `total`), so that they cannot distort any of the existing measurements.
104
104
  * A failing phase is logged and skipped, it never aborts the benchmark.
105
+ * @param calibrate - whether to run the calibration, which describes the machine and hence only has to run for some files of a suite
105
106
  */
106
- measureAdditionalPhases(): Promise<void>;
107
+ measureAdditionalPhases(calibrate?: boolean): Promise<void>;
107
108
  /**
108
109
  * The additional phases work on the analyzer api, so we have to set up an analyzer for the same request.
109
110
  * All of its analyses happen before the measurement starts.
@@ -349,8 +349,9 @@ class BenchmarkSlicer {
349
349
  * These run *after* all other steps and are excluded from the {@link CommonSlicerMeasurements} (and hence from
350
350
  * the `total`), so that they cannot distort any of the existing measurements.
351
351
  * A failing phase is logged and skipped, it never aborts the benchmark.
352
+ * @param calibrate - whether to run the calibration, which describes the machine and hence only has to run for some files of a suite
352
353
  */
353
- async measureAdditionalPhases() {
354
+ async measureAdditionalPhases(calibrate = true) {
354
355
  this.totalStopwatch.pause();
355
356
  try {
356
357
  this.guardActive();
@@ -359,8 +360,10 @@ class BenchmarkSlicer {
359
360
  await this.measureAdditional('dependencies query', () => analyzer.query([{ type: 'dependencies' }]));
360
361
  await this.measureAdditional('linter run', () => analyzer.query([{ type: 'linter' }]));
361
362
  }
362
- /* the calibration times itself, so that neither the warmup nor the rounds it discards count */
363
- this.additionalMeasurements.set('calibration', (0, calibration_1.runCalibration)());
363
+ if (calibrate) {
364
+ /* the calibration times itself, so that neither the warmup nor the reps it discards count */
365
+ this.additionalMeasurements.set('calibration', (0, calibration_1.runCalibration)());
366
+ }
364
367
  }
365
368
  catch (e) {
366
369
  exports.benchmarkLogger.error(`failed to measure the additional phases: ${e instanceof Error ? e.message : String(e)}`);
@@ -11,6 +11,7 @@ const assert_1 = require("../util/assert");
11
11
  const files_1 = require("../util/files");
12
12
  const log_1 = require("../util/log");
13
13
  const parallel_1 = require("../util/parallel");
14
+ const calibration_1 = require("../benchmark/calibration");
14
15
  const script_1 = require("./common/script");
15
16
  const options = (0, script_1.processCommandLineArgs)('benchmark', [], {
16
17
  subtitle: 'Slice given files with additional benchmark information',
@@ -64,6 +65,7 @@ async function benchmark() {
64
65
  }
65
66
  const limit = options.limit ?? files.length;
66
67
  const verboseAdd = options.verbose ? ['--verbose'] : [];
68
+ const calibrationStep = Math.max(1, Math.ceil(files.length / calibration_1.CalibrationSamples));
67
69
  const args = files.map((f, i) => [
68
70
  '--input', f.request.content,
69
71
  '--file-id', `${i}`,
@@ -77,7 +79,8 @@ async function benchmark() {
77
79
  ...(options.seed ? ['--seed', options.seed] : []),
78
80
  ...(options.cfg ? ['--cfg'] : []),
79
81
  ...(options.cg ? ['--cg'] : []),
80
- ...(options['no-extra-phases'] ? ['--no-extra-phases'] : [])
82
+ ...(options['no-extra-phases'] ? ['--no-extra-phases'] : []),
83
+ ...(i % calibrationStep === 0 ? ['--calibrate'] : [])
81
84
  ]);
82
85
  const runs = options.runs ?? 1;
83
86
  for (let i = 1; i <= runs; i++) {
@@ -13,6 +13,7 @@ export interface SingleBenchmarkCliOptions {
13
13
  cfg: boolean;
14
14
  cg: boolean;
15
15
  'no-extra-phases': boolean;
16
+ calibrate: boolean;
16
17
  threshold?: number;
17
18
  'sampling-strategy': string;
18
19
  seed?: string;
@@ -82,9 +82,9 @@ async function benchmark() {
82
82
  console.log(`${prefix} Skipping data frame shape inference: ${e instanceof Error ? e.message : String(e)}`);
83
83
  }
84
84
  }
85
- console.log(`${prefix} Measuring the additional phases (dependencies query, linter, calibration)`);
85
+ console.log(`${prefix} Measuring the additional phases (dependencies query, linter${options.calibrate ? ', calibration' : ''})`);
86
86
  if (!options['no-extra-phases']) {
87
- await slicer.measureAdditionalPhases();
87
+ await slicer.measureAdditionalPhases(options.calibrate);
88
88
  }
89
89
  const { stats } = slicer.finish();
90
90
  const output = {
@@ -200,6 +200,11 @@ export declare const benchmarkHelperOptions: [{
200
200
  readonly type: BooleanConstructor;
201
201
  readonly description: "Skip the dependencies query, the linter run and the calibration, which cost suite runtime";
202
202
  readonly defaultValue: false;
203
+ }, {
204
+ readonly name: "calibrate";
205
+ readonly type: BooleanConstructor;
206
+ readonly description: "Run the machine calibration workload, which describes the machine and not the file, so only a few files of a suite carry it";
207
+ readonly defaultValue: false;
203
208
  }, {
204
209
  readonly name: "seed";
205
210
  readonly type: StringConstructor;
@@ -46,6 +46,7 @@ exports.benchmarkHelperOptions = [
46
46
  { name: 'threshold', alias: 't', type: Number, description: 'How many re-visits of the same node are ok?', defaultValue: undefined, typeLabel: '{underline number}' },
47
47
  { name: 'sampling-strategy', type: String, description: 'Which strategy to use, when sampling is enabled', defaultValue: 'random', typeLabel: '{underline random/equidistant}' },
48
48
  { name: 'no-extra-phases', type: Boolean, description: 'Skip the dependencies query, the linter run and the calibration, which cost suite runtime', defaultValue: false },
49
+ { name: 'calibrate', type: Boolean, description: 'Run the machine calibration workload, which describes the machine and not the file, so only a few files of a suite carry it', defaultValue: false },
49
50
  { name: 'seed', type: String, description: 'The random seed for sampling the slicing criteria if a maximum is set' },
50
51
  ];
51
52
  exports.slicerOptions = [
@@ -321,6 +321,11 @@ declare const _scripts: {
321
321
  readonly type: BooleanConstructor;
322
322
  readonly description: "Skip the dependencies query, the linter run and the calibration, which cost suite runtime";
323
323
  readonly defaultValue: false;
324
+ }, {
325
+ readonly name: "calibrate";
326
+ readonly type: BooleanConstructor;
327
+ readonly description: "Run the machine calibration workload, which describes the machine and not the file, so only a few files of a suite carry it";
328
+ readonly defaultValue: false;
324
329
  }, {
325
330
  readonly name: "seed";
326
331
  readonly type: StringConstructor;
@@ -14,8 +14,8 @@ export declare function stdioCaptureProcessor(stdio: Stdio, onStdOutLine: (msg:
14
14
  * It is probably best to use {@link __dirname} so you can specify the module relative to your
15
15
  * current one.
16
16
  * @param args - The arguments you want to start your process with.
17
- * @param io - If you omit this argument, the in-, out- and error-channels of the script execution
18
- * will be automatically forwarded to the respective in-, out- and error-channels of your process.
17
+ * @param io - If you omit this argument, the in-, out-, and error-channels of the script execution
18
+ * will be automatically forwarded to the respective in-, out-, and error-channels of your process.
19
19
  * However, by defining `io` you essentially gain full control on what should happen
20
20
  * with these streams. For a simple capturing processor, for example if you want to collect
21
21
  * the output of the script, see {@link stdioCaptureProcessor}.
@@ -36,8 +36,8 @@ function stdioCaptureProcessor(stdio, onStdOutLine, onStdErrLine) {
36
36
  * It is probably best to use {@link __dirname} so you can specify the module relative to your
37
37
  * current one.
38
38
  * @param args - The arguments you want to start your process with.
39
- * @param io - If you omit this argument, the in-, out- and error-channels of the script execution
40
- * will be automatically forwarded to the respective in-, out- and error-channels of your process.
39
+ * @param io - If you omit this argument, the in-, out-, and error-channels of the script execution
40
+ * will be automatically forwarded to the respective in-, out-, and error-channels of your process.
41
41
  * However, by defining `io` you essentially gain full control on what should happen
42
42
  * with these streams. For a simple capturing processor, for example if you want to collect
43
43
  * the output of the script, see {@link stdioCaptureProcessor}.
package/config.js CHANGED
@@ -16,7 +16,6 @@ const log_1 = require("./util/log");
16
16
  const files_1 = require("./util/files");
17
17
  const joi_1 = __importDefault(require("joi"));
18
18
  const project_kind_1 = require("./project/context/project-kind");
19
- const object_path_1 = __importDefault(require("object-path"));
20
19
  const gas_1 = require("./gas");
21
20
  const input_types_1 = require("./queries/catalog/input-sources-query/input-types");
22
21
  var VariableResolve;
@@ -608,7 +607,7 @@ exports.FlowrConfig = {
608
607
  continue;
609
608
  }
610
609
  try {
611
- object_path_1.default.set(config, key, JSON.parse(line.slice(at + 1)));
610
+ (0, objects_1.setOnPath)(config, key, JSON.parse(line.slice(at + 1)));
612
611
  }
613
612
  catch { /* a value nobody can read is one to leave alone */ }
614
613
  }
@@ -627,7 +626,7 @@ exports.FlowrConfig = {
627
626
  */
628
627
  setInConfig(config, key, value) {
629
628
  const clone = exports.FlowrConfig.clone(config);
630
- object_path_1.default.set(clone, key, value);
629
+ (0, objects_1.setOnPath)(clone, key, value);
631
630
  return clone;
632
631
  },
633
632
  /**
@@ -635,7 +634,7 @@ exports.FlowrConfig = {
635
634
  * @see {@link setInConfig} for a version that returns a new config object instead of modifying the given one in place.
636
635
  */
637
636
  setInConfigInPlace(config, key, value) {
638
- object_path_1.default.set(config, key, value);
637
+ (0, objects_1.setOnPath)(config, key, value);
639
638
  },
640
639
  };
641
640
  /** Path to the user-global `flowr.json`, read as a fallback when no project config is found. */
@@ -656,9 +655,9 @@ function persistSigDbPathToGlobalConfig(dbPath) {
656
655
  catch (e) {
657
656
  log_1.log.warn(`Could not read global config ${file}, recreating it: ${e.message}`);
658
657
  }
659
- const current = object_path_1.default.get(raw, 'solver.sigdb.additionalPaths');
658
+ const current = (0, objects_1.getOnPath)(raw, 'solver.sigdb.additionalPaths');
660
659
  const paths = Array.isArray(current) ? current : [];
661
- object_path_1.default.set(raw, 'solver.sigdb.additionalPaths', [...new Set([...paths, dbPath])]);
660
+ (0, objects_1.setOnPath)(raw, 'solver.sigdb.additionalPaths', [...new Set([...paths, dbPath])]);
662
661
  fs_1.default.mkdirSync(path_1.default.dirname(file), { recursive: true });
663
662
  fs_1.default.writeFileSync(file, JSON.stringify(raw, null, '\t') + '\n');
664
663
  return file;
@@ -76,7 +76,7 @@ function weakenName(env, name, cds) {
76
76
  current.cache?.delete(plainName);
77
77
  }
78
78
  }
79
- current = current.parent;
79
+ current = current.writableParent;
80
80
  }
81
81
  }
82
82
  /** attaches `cds` to every user definition in the current frame, except the re-defined names */
@@ -33,7 +33,9 @@ export declare enum ArgProp {
33
33
  * only atomic data works here, never a closure, as with `e1` in `e1 > e2`. A bare symbol in such an
34
34
  * argument therefore names a variable even when a function of that name is in scope.
35
35
  */
36
- Atomic = 2048
36
+ Atomic = 2048,
37
+ /** the open handle the call acts on, like `con` in `close(con)` */
38
+ Handle = 4096
37
39
  }
38
40
  /**
39
41
  * What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
@@ -107,7 +109,9 @@ export declare enum CallProp {
107
109
  /** yields the paths it matches at run time rather than one it was handed (`list.files`, `Sys.glob`); empty is an answer */
108
110
  Glob = 33554432,
109
111
  /** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
110
- CommandLine = 67108864
112
+ CommandLine = 67108864,
113
+ /** hands back a handle the program is expected to close again, like `file` or `DBI::dbConnect` */
114
+ Opens = 134217728
111
115
  }
112
116
  /**
113
117
  * The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
@@ -39,6 +39,8 @@ var ArgProp;
39
39
  * argument therefore names a variable even when a function of that name is in scope.
40
40
  */
41
41
  ArgProp[ArgProp["Atomic"] = 2048] = "Atomic";
42
+ /** the open handle the call acts on, like `con` in `close(con)` */
43
+ ArgProp[ArgProp["Handle"] = 4096] = "Handle";
42
44
  })(ArgProp || (exports.ArgProp = ArgProp = {}));
43
45
  /**
44
46
  * What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
@@ -114,6 +116,8 @@ var CallProp;
114
116
  CallProp[CallProp["Glob"] = 33554432] = "Glob";
115
117
  /** hands back what the program was invoked with, as `commandArgs` and the option parsers built on it do */
116
118
  CallProp[CallProp["CommandLine"] = 67108864] = "CommandLine";
119
+ /** hands back a handle the program is expected to close again, like `file` or `DBI::dbConnect` */
120
+ CallProp[CallProp["Opens"] = 134217728] = "Opens";
117
121
  })(CallProp || (exports.CallProp = CallProp = {}));
118
122
  /**
119
123
  * The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
@@ -122,7 +126,7 @@ var CallProp;
122
126
  exports.ImpureProps = CallProp.MayPure | CallProp.Scope | CallProp.NonDet | CallProp.Random | CallProp.Ambient
123
127
  | CallProp.File | CallProp.TempFile | CallProp.Network | CallProp.Process | CallProp.Ffi | CallProp.Lang
124
128
  | CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes | CallProp.Prints
125
- | CallProp.Configures | CallProp.Closes | CallProp.CommandLine;
129
+ | CallProp.Configures | CallProp.Closes | CallProp.Opens | CallProp.CommandLine;
126
130
  /**
127
131
  * Which {@link CallProp} bits rule each other out, as `[bit, everything stating it forbids]`. A definition
128
132
  * that carries the left bit must carry none of the right ones; a test checks the {@link DefaultBuiltinConfig}