Skip to content

Commit eef0ec1

Browse files
hoxyqfacebook-github-bot
authored andcommitted
Simple Fantom benchmark (facebook#54333)
Summary: # Changelog: [Internal] I couldn't add it to the previous diff, since console.createTask is not present on the base revision. See [1]. Differential Revision: D85860982
1 parent a2a47d5 commit eef0ec1

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict-local
8+
* @format
9+
* @fantom_mode dev
10+
*/
11+
12+
/**
13+
* We force the DEV mode, because Fusebox infra is not installed in production builds.
14+
* We want to benchmark the implementation, not the polyfill.
15+
*/
16+
17+
import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
18+
19+
import * as Fantom from '@react-native/fantom';
20+
21+
const fn = () => {};
22+
23+
Fantom.unstable_benchmark
24+
.suite('console.createTask', {
25+
minIterations: 50000,
26+
disableOptimizedBuildCheck: true,
27+
})
28+
.test('JavaScript shim', () => {
29+
const task: ConsoleTask = {run: cb => cb()};
30+
task.run(fn);
31+
})
32+
.test('implementation', () => {
33+
const task = console.createTask('task');
34+
task.run(fn);
35+
});

0 commit comments

Comments
 (0)