Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
2c572d0
dep(dataflow): added tinypool as dependency #2043
jang1er Nov 27, 2025
0688c11
feat(parallel-dataflow): basic threadpool implementation #2052
jang1er Nov 27, 2025
a4796f3
feat(parallel-dataflow): implemented basic usage of threadpool
jang1er Nov 27, 2025
f9a77ea
feat-fix(parallel-dataflow): fixed lintr issues
jang1er Nov 27, 2025
ed5076c
refactor: first draft at worker
EagleoutIce Nov 28, 2025
2114c0b
dep(parallel-dataflow): switched to piscina as threadpool #2043
jang1er Nov 29, 2025
bf6ac00
refactor(parallel-dataflow): refactored threadpool to use piscina
jang1er Nov 29, 2025
0817ac4
refactor(parallel-dataflow): fixed all linter issues
jang1er Dec 1, 2025
3999d07
feat(parallel-dataflow): dataflow merging in own function
jang1er Dec 1, 2025
e98ea89
feat(parallel-dataflow): implemented feature flags #2054
jang1er Dec 6, 2025
80ac00e
dep(dataflow): added tinypool as dependency #2043
jang1er Nov 27, 2025
706d383
feat(parallel-dataflow): basic threadpool implementation #2052
jang1er Nov 27, 2025
c25a774
feat(parallel-dataflow): implemented basic usage of threadpool
jang1er Nov 27, 2025
5944839
feat-fix(parallel-dataflow): fixed lintr issues
jang1er Nov 27, 2025
63578ab
refactor: first draft at worker
EagleoutIce Nov 28, 2025
f65e0ae
dep(parallel-dataflow): switched to piscina as threadpool #2043
jang1er Nov 29, 2025
694eb12
refactor(parallel-dataflow): refactored threadpool to use piscina
jang1er Nov 29, 2025
eebfd91
refactor(parallel-dataflow): fixed all linter issues
jang1er Dec 1, 2025
2e4799a
feat(parallel-dataflow): dataflow merging in own function
jang1er Dec 1, 2025
056efe4
feat(parallel-dataflow): implemented feature flags #2054
jang1er Dec 6, 2025
65235d4
Merge branch '2042-file-level-parallelization-of-the-dataflow-analysi…
jang1er Dec 6, 2025
5720d1c
feat-fix(parallel-dataflow): workerId now used correctly
jang1er Dec 8, 2025
c00d056
feat-fix(parallel-dataflow): updated threadpool
jang1er Dec 8, 2025
d219eeb
refactor(parallel-dataflow): linter fixes
jang1er Dec 8, 2025
544686c
feat(parallel-dataflow): clonable data draft
jang1er Dec 8, 2025
fad9c6d
refactor(parallel-dataflow): linter fixes
jang1er Dec 8, 2025
327755b
feat-fix(parallel-dataflow): fixed worker loading
jang1er Dec 10, 2025
18c1ec0
feat(parallel-dataflow): init promise for workers
jang1er Dec 10, 2025
5dacc81
refactor(parallel-dataflow): feature manager now own class
jang1er Dec 10, 2025
63b426f
feat(parallel-dataflow): featureFlags for analyzer
jang1er Dec 10, 2025
105afe6
feat(parallel-dataflow): feature flags and threadpool init
jang1er Dec 12, 2025
a644543
feat(parallel-dataflow): restored sequential version of dataflow
jang1er Dec 13, 2025
8e4a6dd
feat-fix(parallel-dataflow): switched to .ts only worker file
jang1er Dec 13, 2025
0252c4f
feat(parallel-dataflow): draft serialization
jang1er Dec 16, 2025
8ec9254
feat(parallel-dataflow): linter fixes
jang1er Dec 16, 2025
403a4aa
feat-fix(parallel-dataflow): fixed weird linter changes
jang1er Dec 16, 2025
ab4dc34
feat(parallel-dataflow): env is serializable
jang1er Dec 28, 2025
3a66c22
feat(parallel-dataflow): dataflow graph now serializable
jang1er Dec 28, 2025
49b9888
feat(test-parallel-dataflow): simple tests
jang1er Dec 28, 2025
ed4bbf6
feat(parallel-dataflow): linter fixes
jang1er Dec 28, 2025
71eb605
feat(parallel-dataflow): successfull file parallelization
jang1er Dec 29, 2025
ee6b599
feat-fix: parallelize
EagleoutIce Dec 30, 2025
146f92f
feat-fix(parallel-dataflow): successful parallelization
jang1er Dec 31, 2025
a6fb3b3
refactor(parallel-dataflow): migrated feature flags to config
jang1er Jan 5, 2026
d0a661b
refactor(parallel-dataflow): renamed to workerPool
jang1er Jan 5, 2026
04117eb
refactor(parallel-dataflow): removed debug logs
jang1er Jan 6, 2026
ca54fc3
feat(parallel-dataflow): included wtfnode as dev-dep
jang1er Jan 17, 2026
09dd818
feat(parallel-dataflow): implemented debug tasks
jang1er Jan 19, 2026
070554f
refactor(parallel-dataflow): added option to keep parser alive
jang1er Jan 19, 2026
2481c60
refactor(parallel-dataflow): close analyzer after each tests
jang1er Jan 19, 2026
904019c
feat(parallel-dataflow): clean up and stats collection
jang1er Jan 19, 2026
ed381b8
feat(parallel-dataflow): utilities for leak detection
jang1er Jan 19, 2026
43ae4c4
feat(parallel-dataflow): simple tests for functionality
jang1er Jan 19, 2026
57852a3
deps(parallel-dataflow): added serialize javascript as dependency
jang1er Jan 22, 2026
50873e5
deps(audit): applied audit fixes
jang1er Jan 22, 2026
7085f37
deps(parallel-dataflow): missing package added
jang1er Jan 22, 2026
73fbf38
feat(tests): new tests for parallel-dataflow
jang1er Jan 25, 2026
75f4907
refactor(parallel-dataflow): bundled messages and helpers
jang1er Jan 25, 2026
4b4798b
refactor(parallel-dataflow): incomplete merging and env serialization
jang1er Jan 25, 2026
441846f
feat(parallel-dataflow): dataflow graph can now correctly be serialized
jang1er Jan 30, 2026
bca3836
refactor(parallel-dataflow): moved message definition
jang1er Jan 30, 2026
447fe45
refactor(parallel-dataflow): new tests for parallel dataflow
jang1er Jan 30, 2026
5c6a915
refactor(parallel-dataflow): switched labels in test
jang1er Feb 2, 2026
a108bf3
refactor(parallel-dataflow): replace placeholder builtins
jang1er Feb 2, 2026
dc3ede1
refactor(parallel-dataflow): linter fixes
jang1er Feb 2, 2026
1c4e902
refactor(parallel-files): expected error is handled
jang1er Mar 17, 2026
0796359
refactor(parallel-files): better test execution
jang1er Mar 17, 2026
7f5b2ea
feat(parallel-files): improved serialization tests
jang1er Mar 17, 2026
3302de8
refactor(parallel-files): small updates
jang1er Mar 17, 2026
8b3307a
refactor(parallel-files): updated and fixed linking
jang1er Mar 17, 2026
fe70ed2
refactor(workerpool): removed unecessary type
jang1er Mar 28, 2026
cc5071b
feat(parallel-files): new incomplete state
jang1er Mar 30, 2026
0007c71
feat(parallel-analysis): updated df tests
jang1er Apr 7, 2026
82cf10c
refactor(parallel-files): final draft
jang1er Apr 8, 2026
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
1,410 changes: 829 additions & 581 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"wiki:watch": "ts-node-dev src/cli/wiki.ts -- --keep-alive",
"build": "tsc --project .",
"build-dev": "npm run build && npm run build:copy-wasm",
"build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --bundle --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:copy-wasm",
"build:bundle-flowr": "npm run build && esbuild --bundle dist/src/cli/flowr.js --platform=node --tree-shaking=true --bundle --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/flowr.min.js && npm run build:bundle-worker && npm run build:copy-wasm",
"build:bundle-worker": "npm run build && esbuild --bundle dist/src/dataflow/parallel/worker.js --platform=node --tree-shaking=true --bundle --minify --external:clipboardy --target=node22 --outfile=dist/src/cli/worker.js",
"build:copy-wasm": "mkdir -p dist/node_modules/@eagleoutice/tree-sitter-r/ && mkdir -p dist/node_modules/web-tree-sitter && cp node_modules/@eagleoutice/tree-sitter-r/tree-sitter-r.wasm dist/node_modules/@eagleoutice/tree-sitter-r/ && cp node_modules/web-tree-sitter/tree-sitter.wasm dist/node_modules/web-tree-sitter/",
"lint-local": "npx eslint --version && npx eslint src/ test/ --rule \"no-warning-comments: off\"",
"lint": "npm run license-compat -- --summary && npx eslint --version && npx eslint src/ test/",
Expand Down Expand Up @@ -177,8 +178,10 @@
"@types/object-hash": "^3.0.6",
"@types/seedrandom": "^3.0.8",
"@types/semver": "^7.7.0",
"@types/serialize-javascript": "^5.0.4",
"@types/tmp": "^0.2.6",
"@types/ws": "^8.18.1",
"@types/wtfnode": "^0.10.0",
"@typescript-eslint/eslint-plugin": "^8.40.0",
"@vitest/coverage-v8": "^3.2.4",
"esbuild": "^0.25.9",
Expand Down Expand Up @@ -210,15 +213,19 @@
"n3": "^1.23.1",
"object-hash": "^3.0.0",
"object-sizeof": "^2.6.5",
"piscina": "^5.1.4",
"rotating-file-stream": "^3.2.6",
"seedrandom": "^3.0.5",
"semver": "^7.7.1",
"serialize-javascript": "^7.0.2",
"tar": "^7.4.3",
"tinypool": "^2.0.0",
"tmp": "^0.2.3",
"ts-essentials": "^10.1.1",
"tslog": "^4.9.3",
"web-tree-sitter": "^0.24.7",
"ws": "^8.18.0",
"wtfnode": "^0.10.1",
"xpath-ts2": "^1.4.2"
}
}
24 changes: 24 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import Joi from 'joi';
import type { BuiltInDefinitions } from './dataflow/environments/built-in-config';
import type { KnownParser } from './r-bridge/parser';
import type { DeepWritable } from 'ts-essentials';
import type { WorkerPoolSettings } from './dataflow/parallel/threadpool';
import { WorkerpoolDefaultSettings } from './dataflow/parallel/threadpool';

export enum VariableResolve {
/** Don't resolve constants at all */
Expand Down Expand Up @@ -188,6 +190,19 @@ export interface FlowrConfigOptions extends MergeableRecord {
}
}
}

readonly optimizations: {
readonly fileParallelization: boolean;

readonly dataflowOperationParallelization: boolean;

readonly deferredFunctionEvaluation: boolean;
}

readonly workerPool: {

readonly poolSettings: WorkerPoolSettings;
}
}

export interface TreeSitterEngineConfig extends MergeableRecord {
Expand Down Expand Up @@ -261,6 +276,14 @@ export const defaultConfigOptions: FlowrConfigOptions = {
maxReadLines: 1e6
}
}
},
optimizations: {
fileParallelization: false,
dataflowOperationParallelization: false,
deferredFunctionEvaluation: false,
},
workerPool: {
poolSettings: WorkerpoolDefaultSettings
}
};

Expand Down Expand Up @@ -359,6 +382,7 @@ export function cloneConfig(config: FlowrConfigOptions): FlowrConfigOptions {
return JSON.parse(JSON.stringify(config)) as FlowrConfigOptions;
}


/**
* Loads the flowr config from the given file or the default locations.
*/
Expand Down
11 changes: 9 additions & 2 deletions src/core/steps/all/core/20-dataflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ const staticDataflowCommon = {
dependencies: [ 'normalize' ],
} as const;

function processor(results: { normalize?: NormalizedAst }, input: { parser?: Parser<KnownParserType>, context?: FlowrAnalyzerContext }) {
return produceDataFlowGraph(input.parser as Parser<KnownParserType>, results.normalize as NormalizedAst, input.context as FlowrAnalyzerContext);
function processor(
results: { normalize?: NormalizedAst },
input: { parser?: Parser<KnownParserType>,
context?: FlowrAnalyzerContext,}) {
return produceDataFlowGraph(
input.parser as Parser<KnownParserType>,
results.normalize as NormalizedAst,
input.context as FlowrAnalyzerContext,
);
}

export const STATIC_DATAFLOW = {
Expand Down
84 changes: 83 additions & 1 deletion src/dataflow/environments/built-in.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import type {
BuiltInFunctionDefinition,
BuiltInReplacementDefinition
} from './built-in-config';
import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
import type { FlowrAnalyzerContext, ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';

export type BuiltIn = `built-in:${string}`;

Expand Down Expand Up @@ -212,6 +212,88 @@ export type ConfigOfBuiltInMappingName<N extends BuiltInMappingName> = Parameter

export type BuiltInMemory = Map<Identifier, IdentifierDefinition[]>

type SerializedBuiltInEntry = {
__kind: 'builtin-entry';
name: Identifier;
//definedAt: BuiltIn;
};

type SerializedIdentifierDefinition =
| IdentifierDefinition
| SerializedBuiltInEntry;

export type SerializedBuiltInMemory =
Map<Identifier, SerializedIdentifierDefinition[]>;

function isPureBuiltInEntry(
defs: readonly IdentifierDefinition[]
): boolean {
return defs.every(
d =>
(d.type === ReferenceType.BuiltInFunction ||
d.type === ReferenceType.BuiltInConstant) &&
isBuiltIn(d.definedAt)
);
}

function isSerializedBuiltinEntry(
def: SerializedIdentifierDefinition
): def is SerializedBuiltInEntry {
return (
typeof def === 'object' &&
def !== null &&
(def as SerializedBuiltInEntry).__kind === 'builtin-entry'
);
}


/**
*
*/
export function serializeBuiltInMemory(mem: BuiltInMemory): SerializedBuiltInMemory{
const serMem = new Map<Identifier, SerializedIdentifierDefinition[]>();

for(const [id, defs] of mem.entries()){
if(isPureBuiltInEntry(defs)){
/** just save the name, to recover later */
serMem.set(id, [{
__kind: 'builtin-entry',
name: id,
}]);
} else {
/** handle normally */
serMem.set(id, defs);
}
}
return serMem;
}

/**
*
*/
export function deserializeBuiltInMemory(
mem: SerializedBuiltInMemory,
ctx: FlowrAnalyzerContext
): BuiltInMemory {
const deSerMem = new Map<Identifier, IdentifierDefinition[]>();
for( const [id,defs] of mem.entries()){
if(defs.length === 1 && isSerializedBuiltinEntry(defs[0])){
const builtInDefs = ctx.env.builtInEnvironment.memory.get(defs[0].name);

if(!builtInDefs){
console.warn('Could not recover builtin defs entry: ', defs[0]);
continue;
}
// convert to mutable data and clone to sever connection to readonly object
deSerMem.set(id, defs.map(def => ({ ...def })) as IdentifierDefinition[]);
} else {
deSerMem.set(id, defs as IdentifierDefinition[]);
}

}
return deSerMem;
}

export class BuiltIns {
/**
* Register a built-in constant (like `NULL` or `TRUE`) to the given {@link builtIns}
Expand Down
Loading
Loading