Test name | Executions per second |
---|---|
parse | 61936.5 Ops/sec |
split | 63986.9 Ops/sec |
regex | 67532.1 Ops/sec |
let a = '{"type":"discussion-post","action":"created","url":"https://lost-cities-keeper.fandom.com/f/p/4400000000000277948/r/4400000000002061507","userName":"AnonymousWikiEditor","snippet":"Omg I screamed when Ariana posted the engagement…","size":66,"category":"Off-Topic"}';
let b = JSON.parse(a);
console.log(b.url);
let a = '{"type":"discussion-post","action":"created","url":"https://lost-cities-keeper.fandom.com/f/p/4400000000000277948/r/4400000000002061507","userName":"AnonymousWikiEditor","snippet":"Omg I screamed when Ariana posted the engagement…","size":66,"category":"Off-Topic"}';
let b = a.split('"url":"')[1];
b = b.split('","')[0];
console.log(b);
let a = '{"type":"discussion-post","action":"created","url":"https://lost-cities-keeper.fandom.com/f/p/4400000000000277948/r/4400000000002061507","userName":"AnonymousWikiEditor","snippet":"Omg I screamed when Ariana posted the engagement…","size":66,"category":"Off-Topic"}';
let regexp = /"url":"(https:\/\/.*?)"/g;
let b = regexp.exec(a)[1];
console.log(b);