Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [3.0.3](https://github.com/optave/codegraph/compare/v3.0.2...v3.0.3) (2026-03-04)

### Performance

* **ast:** use single transaction for AST node insertion — astMs drops from ~3600ms to ~350ms (native) and ~547ms (WASM), reducing overall native build from 24.9 to 8.5 ms/file ([#333](https://github.com/optave/codegraph/pull/333))

## [3.0.2](https://github.com/optave/codegraph/compare/v3.0.1...v3.0.2) (2026-03-04)

**Dataflow goes multi-language, build performance recovery, and native engine parity fixes.** This patch extends dataflow analysis from JS/TS-only to all 11 supported languages, recovers build performance lost after CFG/dataflow became default-on, fixes language-aware identifier collection in dataflow, and closes a native engine scoping bug for constants.
Expand Down
2 changes: 1 addition & 1 deletion crates/codegraph-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "codegraph-core"
version = "3.0.2"
version = "3.0.3"
edition = "2021"
license = "Apache-2.0"

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@optave/codegraph",
"version": "3.0.2",
"version": "3.0.3",
"description": "Local code graph CLI — parse codebases with tree-sitter, build dependency graphs, query them",
"type": "module",
"main": "src/index.js",
Expand Down
20 changes: 9 additions & 11 deletions src/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,12 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
}
});

let totalInserted = 0;
const allRows = [];

for (const [relPath, symbols] of fileSymbols) {
const rows = [];
const defs = symbols.definitions || [];

// Pre-load all node IDs for this file into a map
// Pre-load all node IDs for this file into a map (read-only, fast)
const nodeIdMap = new Map();
for (const row of bulkGetNodeIds.all(relPath)) {
nodeIdMap.set(`${row.name}|${row.kind}|${row.line}`, row.id);
Expand All @@ -186,7 +185,7 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
parentNodeId =
nodeIdMap.get(`${parentDef.name}|${parentDef.kind}|${parentDef.line}`) || null;
}
rows.push({
allRows.push({
file: relPath,
line: call.line,
kind: 'call',
Expand All @@ -205,7 +204,7 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
// WASM path: walk the tree-sitter AST
const astRows = [];
walkAst(symbols._tree.rootNode, defs, relPath, astRows, nodeIdMap);
rows.push(...astRows);
allRows.push(...astRows);
} else if (symbols.astNodes?.length) {
// Native path: use pre-extracted AST nodes from Rust
for (const n of symbols.astNodes) {
Expand All @@ -215,7 +214,7 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
parentNodeId =
nodeIdMap.get(`${parentDef.name}|${parentDef.kind}|${parentDef.line}`) || null;
}
rows.push({
allRows.push({
file: relPath,
line: n.line,
kind: n.kind,
Expand All @@ -227,14 +226,13 @@ export async function buildAstNodes(db, fileSymbols, _rootDir, _engineOpts) {
}
}
}
}

if (rows.length > 0) {
tx(rows);
totalInserted += rows.length;
}
if (allRows.length > 0) {
tx(allRows);
}

debug(`AST extraction: ${totalInserted} nodes stored`);
debug(`AST extraction: ${allRows.length} nodes stored`);
}

/**
Expand Down