Skip to content

Commit 6d12ee2

Browse files
authored
update the macro benchmark with the new apis (#2190)
1 parent 1e0e53e commit 6d12ee2

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

working/macros/example/benchmark/simple.dart

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ Host app mode: $hostMode
9696
print('This script must be ran from the `macros` directory.');
9797
exit(1);
9898
}
99-
_log('Preparing to run macros');
100-
var executor = macroExecutionStrategy == 'aot'
101-
? await processExecutor.start(serverSerializationMode)
102-
: await isolatedExecutor.start(serverSerializationMode);
10399
var tmpDir = Directory.systemTemp.createTempSync('data_class_macro_example');
104100
try {
105101
var macroUri = Uri.parse('package:macro_proposal/data_class.dart');
@@ -133,12 +129,18 @@ Host app mode: $hostMode
133129
exit(1);
134130
}
135131

136-
_log('Loading DataClass macro');
137-
var clazzId = await executor.loadMacro(macroUri, macroName,
138-
precompiledKernelUri: kernelOutputFile.uri);
132+
_log('Loading the macro executor');
133+
var executor = macroExecutionStrategy == 'aot'
134+
? await processExecutor.start(
135+
serverSerializationMode,
136+
processExecutor.CommunicationChannel.socket,
137+
kernelOutputFile.uri.toFilePath())
138+
: await isolatedExecutor.start(
139+
serverSerializationMode, kernelOutputFile.uri);
140+
139141
_log('Instantiating macro');
140-
var instanceId =
141-
await executor.instantiateMacro(clazzId, '', Arguments([], {}));
142+
var instanceId = await executor.instantiateMacro(
143+
macroUri, macroName, '', Arguments([], {}));
142144

143145
_log('Running DataClass macro 100 times...');
144146
var results = <MacroExecutionResult>[];

0 commit comments

Comments
 (0)