Files
Mert Can Altin 610fcd8341 src: use simdutf for two-byte utf8 conversion
Signed-off-by: Mert Can Altin <mertgold60@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/62248
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2026-08-21 17:06:02 +00:00

26 lines
635 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
type: ['ascii', 'two_bytes', 'three_bytes', 'mixed'],
n: [5e6],
});
const urls = {
ascii: 'https://example.com/path/to/resource?query=value&foo=bar',
two_bytes: 'https://example.com/yol/türkçe/içerik?sağlık=değer',
three_bytes: 'https://example.com/路径/资源?查询=值&名称=数据',
mixed: 'https://example.com/hello/世界/path?name=değer&key=数据',
};
function main({ n, type }) {
const str = urls[type];
bench.start();
for (let i = 0; i < n; i++) {
URL.canParse(str);
}
bench.end(n);
}