-
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
18 changed files
with
1,094 additions
and
315 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
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 |
---|---|---|
@@ -1,3 +1,13 @@ | ||
import { jsonReplacer } from '../../util/json'; | ||
|
||
export function codeBlock(language: string, code: string | undefined): string { | ||
return `\n\`\`\`${language}\n${code?.trim() ?? ''}\n\`\`\`\n`; | ||
} | ||
|
||
export function jsonWithLimit(object: object, maxLength: number = 5_000, tooLongText: string = '_As the code is pretty long, we inhibit pretty printing and syntax highlighting (JSON):_'): string { | ||
const prettyPrinted = JSON.stringify(object, jsonReplacer, 2); | ||
return ` | ||
${prettyPrinted.length > maxLength ? tooLongText : ''} | ||
${codeBlock(prettyPrinted.length > maxLength ? 'text' : 'json', prettyPrinted.length > 5_000 ? JSON.stringify(object, jsonReplacer) : prettyPrinted)} | ||
`; | ||
} |
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
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
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
4 changes: 2 additions & 2 deletions
4
...ontext-query/call-context-query-format.ts → ...ontext-query/call-context-query-format.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
17 changes: 17 additions & 0 deletions
17
src/queries/catalog/dataflow-query/dataflow-query-executor.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,17 @@ | ||
import type { BasicQueryData } from '../../query'; | ||
import type { DataflowQuery, DataflowQueryResult } from './dataflow-query-format'; | ||
import { log } from '../../../util/log'; | ||
|
||
|
||
export function executeDataflowQuery({ graph }: BasicQueryData, queries: readonly DataflowQuery[]): DataflowQueryResult { | ||
if(queries.length !== 1) { | ||
log.warn('Dataflow query expects only up to one query, but got', queries.length); | ||
} | ||
return { | ||
'.meta': { | ||
/* there is no sense in measuring a get */ | ||
timing: 0 | ||
}, | ||
graph | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/queries/catalog/dataflow-query/dataflow-query-format.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,14 @@ | ||
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format'; | ||
import type { DataflowGraph } from '../../../dataflow/graph/graph'; | ||
|
||
/** | ||
* Simple re-returns the dataflow graph of the analysis. | ||
*/ | ||
export interface DataflowQuery extends BaseQueryFormat { | ||
readonly type: 'dataflow'; | ||
} | ||
|
||
export interface DataflowQueryResult extends BaseQueryResult { | ||
/** Please be aware that this is the graph in its JSON representation, use {@link DataflowGraph#fromJson} if the result is serialized */ | ||
readonly graph: DataflowGraph; | ||
} |
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
Oops, something went wrong.
32d51e8
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
Retrieve AST from R code
236.48823454545453
ms (100.95124305461889
)238.12351204545453
ms (103.59720843756357
)0.99
Normalize R AST
18.6814945
ms (32.43041376202251
)19.968034227272728
ms (34.84298543847825
)0.94
Produce dataflow information
39.218006409090904
ms (83.23010785098833
)38.310942090909094
ms (82.04448044777155
)1.02
Total per-file
814.1409290454545
ms (1464.0122828304495
)811.1703915909092
ms (1431.4404310276739
)1.00
Static slicing
2.297206455224587
ms (1.5987465399086547
)2.258090287874194
ms (1.2792808105316449
)1.02
Reconstruct code
0.23958454615379787
ms (0.19299648466878672
)0.22489327849282828
ms (0.17585774592637268
)1.07
Total per-slice
2.552788396221629
ms (1.670613024578578
)2.4996261233332735
ms (1.3278746913052974
)1.02
failed to reconstruct/re-parse
0
#0
#1
times hit threshold
0
#0
#1
reduction (characters)
0.7869360165281424
#0.7869360165281424
#1
reduction (normalized tokens)
0.7639690077689504
#0.7639690077689504
#1
memory (df-graph)
95.46617542613636
KiB (244.77619956879823
)147.42458274147728
KiB (358.6827375397903
)0.65
This comment was automatically generated by workflow using github-action-benchmark.
32d51e8
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
Retrieve AST from R code
237.28889544
ms (43.975090915089936
)238.40722376
ms (42.95412443307438
)1.00
Normalize R AST
20.72894466
ms (15.712860099581313
)22.0872248
ms (17.016890594916376
)0.94
Produce dataflow information
76.10204879999999
ms (87.85498320596544
)74.60461736
ms (88.95210983454488
)1.02
Total per-file
7716.47521212
ms (28900.2856987741
)11091.201449639999
ms (52310.41942604725
)0.70
Static slicing
16.07740446755544
ms (44.1702473342068
)22.047137876062838
ms (78.30877993604865
)0.73
Reconstruct code
0.23467998152275588
ms (0.15163252847745484
)0.2327517832436913
ms (0.14954480815603388
)1.01
Total per-slice
16.32001826234056
ms (44.19572290555723
)22.287796325154986
ms (78.33211951742135
)0.73
failed to reconstruct/re-parse
0
#0
#1
times hit threshold
0
#0
#1
reduction (characters)
0.8712997340230448
#0.8719618340615195
#1.00
reduction (normalized tokens)
0.8102441553774778
#0.810633662275233
#1.00
memory (df-graph)
99.8990234375
KiB (113.72812769327498
)145.6434765625
KiB (153.49028997815503
)0.69
This comment was automatically generated by workflow using github-action-benchmark.