Remove now-obsolete Counter

This commit is contained in:
Joscha 2025-01-03 02:43:40 +01:00
parent d9fd29c1c3
commit ee66509dd8

View file

@ -1,46 +1,12 @@
use std::{collections::HashSet, fmt, time::Instant}; use std::{collections::HashSet, fmt};
use regex::Regex; use regex::Regex;
use thousands::Separable;
use crate::{ use crate::{
data::{Data, Page}, data::{Data, Page},
graph::NodeIdx, graph::NodeIdx,
}; };
pub struct Counter {
n: usize,
last_print: Instant,
}
impl Counter {
pub fn new() -> Self {
Self {
n: 0,
last_print: Instant::now(),
}
}
pub fn tick(&mut self) {
self.n += 1;
if self.n % 10_000 != 0 {
return;
}
let now = Instant::now();
if now.duration_since(self.last_print).as_secs() < 4 {
return;
}
println!("{:>12}", self.n.separate_with_underscores());
self.last_print = now;
}
pub fn done(&self) {
println!("{:>12} (done)", self.n.separate_with_underscores());
}
}
// https://github.com/wikimedia/mediawiki-title/blob/6880ae1a9ffdfa2eea9fd75b472493a67dabcc48/lib/mediawiki.Title.phpCharToUpper.js // https://github.com/wikimedia/mediawiki-title/blob/6880ae1a9ffdfa2eea9fd75b472493a67dabcc48/lib/mediawiki.Title.phpCharToUpper.js
struct PhpCharToUpper(char); struct PhpCharToUpper(char);