xref: /third_party/node/benchmark/url/legacy-url-parse.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/benchmark/url/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common.js');
31cb0ef41Sopenharmony_ciconst url = require('url');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciconst bench = common.createBenchmark(main, {
71cb0ef41Sopenharmony_ci  type: common.urlDataTypes,
81cb0ef41Sopenharmony_ci  e: [1],
91cb0ef41Sopenharmony_ci});
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cifunction main({ e, type }) {
121cb0ef41Sopenharmony_ci  const data = common.bakeUrlData(type, e, false, false);
131cb0ef41Sopenharmony_ci  let result = url.parse(data[0]);  // Avoid dead code elimination
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci  bench.start();
161cb0ef41Sopenharmony_ci  for (let i = 0; i < data.length; ++i) {
171cb0ef41Sopenharmony_ci    result = url.parse(data[i]);
181cb0ef41Sopenharmony_ci  }
191cb0ef41Sopenharmony_ci  bench.end(data.length);
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci  assert.ok(result);
221cb0ef41Sopenharmony_ci}
23

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