This is strange, let's see, the current function is like so:
pub fn is_match(&self, regex: Regex) -> bool {
// todo delete printlns
let mut list = self.matches.borrow_mut();
let regex_str = regex.as_str().to_string();
// *list
// .entry(regex_str)
// .or_insert(regex.is_match(self.get_name()))
if self.get_name().ends_with("nómina") {
print!("{} --{}--", self.id, regex_str);
dbg!(&*list);
}
match list.entry(regex_str) {
Entry::Vacant(entry) => {
*self.misses.borrow_mut() += 1;
if self.get_name().ends_with("nómina") {
println!("{} MISS", self.get_name());
}
*entry.insert(regex.is_match(self.get_name()))
}
Entry::Occupied(entry) => {
*self.hits.borrow_mut() += 1;
if self.get_name().ends_with("nómina") {
println!("{} HIT", self.get_name());
}
*entry.get()
}
}
}
And the output (the last part of it, it's about 15 MB) is:
3152039713130906693 --(?i)vactivo--Activo:ING:Cuenta nómina MISS
3152039713130906693 --(?i)vactivo--Activo:ING:Cuenta nómina MISS
[src/models/account.rs:85] &*list = {
"Agua": false,
"(?i)^(Activo:DeGiro)|stockplan|broker": false,
"(?i)(^Activo:Préstamos P2P)|(coinbase|crowdestor|pagatelia|urbanitae|mytriplea|civislend|plus capital|btc-e)": false,
"Hogar:Comunidad": false,
"(?i)^Activo:(.*:(cobas|fondo|azvalor|indexa)|Renta 4)": false,
"(^Activo:Inmuebles)|(^Activo:Coches)": false,
"^Activo:Holding": false,
"(?i)Hogar:Comunidad": false,
"(?i)(^Activo:Raisin Ceci|:raisin:depósitos)|(^Activo:(.*naranja|.*depósito|.*impuestos cero))": false,
"(?i)^Activo:(Paypal|Efectivo|Transferwise|Revolut|.*corriente|.*nómina|.*cuenta común)": true,
}
[src/models/account.rs:85] &*list = {
"Agua": false,
"(?i)^(Activo:DeGiro)|stockplan|broker": false,
"(?i)(^Activo:Préstamos P2P)|(coinbase|crowdestor|pagatelia|urbanitae|mytriplea|civislend|plus capital|btc-e)": false,
"Hogar:Comunidad": false,
"(?i)^Activo:(.*:(cobas|fondo|azvalor|indexa)|Renta 4)": false,
"(^Activo:Inmuebles)|(^Activo:Coches)": false,
"^Activo:Holding": false,
"(?i)Hogar:Comunidad": false,
"(?i)(^Activo:Raisin Ceci|:raisin:depósitos)|(^Activo:(.*naranja|.*depósito|.*impuestos cero))": false,
"(?i)^Activo:(Paypal|Efectivo|Transferwise|Revolut|.*corriente|.*nómina|.*cuenta común)": true,
}
What I don't get is that there is a MISS both times. After the first miss, the entry should be added to the cache and (?i)vactivo
be part of the hashmap.
Not sure what's going on.
(But thanks, I didn't know about the dbg macro)