Skip to content

Commit 8ec75a6

Browse files
hoxyqmeta-codesync[bot]
authored andcommitted
Simple Fantom benchmark (#54333)
Summary: Pull Request resolved: #54333 # Changelog: [Internal] I couldn't add it to the previous diff, since console.createTask is not present on the base revision. See [1]. Reviewed By: sbuggay Differential Revision: D85860982 fbshipit-source-id: cf78dfc3ba1653a0cd133d924d18a2129cb5b1a4
1 parent 33ec061 commit 8ec75a6

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

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)