Skip to content

Commit

Permalink
Add test for normalized AST query (#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
EagleoutIce authored Oct 8, 2024
2 parents f43dfd8 + e01d547 commit 23c6e03
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/functionality/dataflow/query/normalized-ast-query-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { assertQuery } from '../../_helper/query';
import { label } from '../../_helper/label';
import { withShell } from '../../_helper/shell';
import type {
NormalizedAstQuery
} from '../../../../src/queries/catalog/normalized-ast-query/normalized-ast-query-format';

describe('Normalized AST Query', withShell(shell => {
function testQuery(name: string, code: string, query: readonly NormalizedAstQuery[]) {
assertQuery(label(name), shell, code, query, ({ normalize }) => ({ 'normalized-ast': { normalized: normalize } }));
}

testQuery('Single AST', 'x + 1', [{ type: 'normalized-ast' }]);
testQuery('Multiple Queries', 'x + 1', [{ type: 'normalized-ast' }, { type: 'normalized-ast' }, { type: 'normalized-ast' }]);
}));

2 comments on commit 23c6e03

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"artificial" Benchmark Suite

Benchmark suite Current: 23c6e03 Previous: 9d8b361 Ratio
Retrieve AST from R code 243.13323986363636 ms (105.59366311378498) 238.12351204545453 ms (103.59720843756357) 1.02
Normalize R AST 18.74111159090909 ms (32.907205035009476) 19.968034227272728 ms (34.84298543847825) 0.94
Produce dataflow information 38.698419 ms (83.6150756861185) 38.310942090909094 ms (82.04448044777155) 1.01
Total per-file 838.2103276363637 ms (1512.9867640600821) 811.1703915909092 ms (1431.4404310276739) 1.03
Static slicing 2.2141012547250014 ms (1.3579040184047382) 2.258090287874194 ms (1.2792808105316449) 0.98
Reconstruct code 0.25193069514039046 ms (0.20346727275655424) 0.22489327849282828 ms (0.17585774592637268) 1.12
Total per-slice 2.48231607205614 ms (1.4296844152994042) 2.4996261233332735 ms (1.3278746913052974) 0.99
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.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"social-science" Benchmark Suite

Benchmark suite Current: 23c6e03 Previous: 9d8b361 Ratio
Retrieve AST from R code 241.41289436000002 ms (45.003140713822305) 238.40722376 ms (42.95412443307438) 1.01
Normalize R AST 21.13826492 ms (15.675869954981232) 22.0872248 ms (17.016890594916376) 0.96
Produce dataflow information 77.01913464 ms (89.73835783255598) 74.60461736 ms (88.95210983454488) 1.03
Total per-file 7893.35365022 ms (29676.483187369544) 11091.201449639999 ms (52310.41942604725) 0.71
Static slicing 16.427489658444387 ms (45.294716313039) 22.047137876062838 ms (78.30877993604865) 0.75
Reconstruct code 0.2579562588259661 ms (0.15901367079252343) 0.2327517832436913 ms (0.14954480815603388) 1.11
Total per-slice 16.69385903922209 ms (45.320710611272055) 22.287796325154986 ms (78.33211951742135) 0.75
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.

Please sign in to comment.