basant307/AI_Governance_Project
048
1import { Bench } from 'tinybench'2import { fastUri } from '../index.js'3 4const {5 equal: fastUriEqual,6 parse: fastUriParse,7} = fastUri8 9const stringA = 'example://a/b/c/%7Bfoo%7D'10const stringB = 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'11 12const componentA = fastUriParse(stringA)13const componentB = fastUriParse(stringB)14 15const benchFastUri = new Bench({ name: 'fast-uri equal' })16 17benchFastUri.add('equal string with string', function () {18 fastUriEqual(stringA, stringA)19})20 21benchFastUri.add('equal component with component', function () {22 fastUriEqual(componentA, componentA)23})24 25benchFastUri.add('equal component with string', function () {26 fastUriEqual(componentA, stringA)27})28 29benchFastUri.add('equal string with component', function () {30 fastUriEqual(stringA, componentA)31})32 33benchFastUri.add('not equal string with string', function () {34 fastUriEqual(stringA, stringB)35})36 37benchFastUri.add('not equal component with component', function () {38 fastUriEqual(componentA, componentB)39})40 41benchFastUri.add('not equal component with string', function () {42 fastUriEqual(componentA, stringB)43})44 45benchFastUri.add('not equal string with component', function () {46 fastUriEqual(stringA, componentB)47})48 49await benchFastUri.run()50console.log(benchFastUri.name)51console.table(benchFastUri.table())52 