squeeze the last ms of performance out of the rewriter

This commit is contained in:
velzie 2024-07-17 18:42:20 -04:00
parent 213f7bfa2b
commit 41acba634d
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
5 changed files with 31 additions and 152 deletions

View file

@ -1,5 +1,9 @@
#![allow(clippy::print_stdout)]
use std::{env, path::Path, str::FromStr};
use std::{
env,
path::Path,
str::{from_utf8, FromStr},
};
use oxc_allocator::Allocator;
use oxc_ast::{
@ -28,10 +32,15 @@ fn main() -> std::io::Result<()> {
println!(
"{}",
rewrite(
&source_text,
Url::from_str("https://google.com/glorngle/si.js").unwrap()
from_utf8(
rewrite(
&source_text,
Url::from_str("https://google.com/glorngle/si.js").unwrap()
)
.as_slice()
)
.unwrap()
.to_string()
);
Ok(())