Skip to content

Commit

Permalink
chore: change default file hasher to fxhash
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix-ru committed May 5, 2024
1 parent daa5c20 commit 5e85720
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/fervid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ use fervid_parser::SfcParser;
use fervid_transform::{style::should_transform_style_block, transform_sfc, TransformSfcOptions};
use std::{
borrow::Cow,
collections::hash_map::DefaultHasher,
hash::{Hash, Hasher},
};
use swc_core::ecma::ast::Expr;
use fxhash::FxHasher32;

// TODO Add severity to errors
// TODO Better structs
Expand Down Expand Up @@ -130,7 +130,7 @@ pub fn compile(source: &str, options: CompileOptions) -> Result<CompileResult, C
// For scopes
// TODO Research if it's better to compute that on the caller site or here
let file_hash = {
let mut hasher = DefaultHasher::default();
let mut hasher = FxHasher32::default();
source.hash(&mut hasher);
let num = hasher.finish();
format!("{:x}", num)
Expand Down Expand Up @@ -215,7 +215,7 @@ pub fn compile_sync_naive(source: &str, is_prod: bool) -> Result<String, String>

// For scopes
let file_hash = {
let mut hasher = DefaultHasher::default();
let mut hasher = FxHasher32::default();
source.hash(&mut hasher);
let num = hasher.finish();
format!("{:x}", num)
Expand Down

0 comments on commit 5e85720

Please sign in to comment.