xref: /third_party/node/benchmark/napi/string/index.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/benchmark/napi/string/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../../common.js');
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cilet binding;
51cb0ef41Sopenharmony_citry {
61cb0ef41Sopenharmony_ci  binding = require(`./build/${common.buildType}/binding`);
71cb0ef41Sopenharmony_ci} catch {
81cb0ef41Sopenharmony_ci  console.error(`${__filename}: Binding failed to load`);
91cb0ef41Sopenharmony_ci  process.exit(0);
101cb0ef41Sopenharmony_ci}
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ciconst bench = common.createBenchmark(main, {
131cb0ef41Sopenharmony_ci  n: [1e5, 1e6, 1e7],
141cb0ef41Sopenharmony_ci  stringType: ['Latin1', 'Utf8', 'Utf16'],
151cb0ef41Sopenharmony_ci});
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cifunction main({ n, stringType }) {
181cb0ef41Sopenharmony_ci  binding[`createString${stringType}`](n, bench, bench.start, bench.end);
191cb0ef41Sopenharmony_ci}
20

Indexes created Thu Nov 07 10:32:03 CST 2024