mirror of
https://github.com/mii443/esaxx-rs.git
synced 2025-08-30 18:59:28 +00:00
Become stable compatible.
This commit is contained in:
1
.github/workflows/rust.yml
vendored
1
.github/workflows/rust.yml
vendored
@ -15,7 +15,6 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: |
|
run: |
|
||||||
rustup default nightly
|
|
||||||
rustup component add rustfmt
|
rustup component add rustfmt
|
||||||
rustup component add clippy
|
rustup component add clippy
|
||||||
cargo fmt -- --check
|
cargo fmt -- --check
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "esaxx-rs"
|
name = "esaxx-rs"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
authors = ["Nicolas Patry <patry.nicolas@protonmail.com>"]
|
authors = ["Nicolas Patry <patry.nicolas@protonmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "Wrapping around sentencepiece's esaxxx library."
|
description = "Wrapping around sentencepiece's esaxxx library."
|
||||||
|
43
src/lib.rs
43
src/lib.rs
@ -32,8 +32,6 @@
|
|||||||
//! assert_eq!(iter.next(), Some((&chars[..0], 11))); // ''
|
//! assert_eq!(iter.next(), Some((&chars[..0], 11))); // ''
|
||||||
//! assert_eq!(iter.next(), None);
|
//! assert_eq!(iter.next(), None);
|
||||||
//! ```
|
//! ```
|
||||||
#![feature(test)]
|
|
||||||
extern crate test;
|
|
||||||
|
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
mod esa;
|
mod esa;
|
||||||
@ -216,7 +214,6 @@ impl<'a> Iterator for SuffixIterator<'a, usize> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use test::Bencher;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_esaxx() {
|
fn test_esaxx() {
|
||||||
@ -359,27 +356,27 @@ mod tests {
|
|||||||
assert_eq!(iter.next(), None);
|
assert_eq!(iter.next(), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[bench]
|
// #[bench]
|
||||||
fn bench_esaxx_long(b: &mut Bencher) {
|
// fn bench_esaxx_long(b: &mut Bencher) {
|
||||||
let string = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.".to_string();
|
// let string = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.".to_string();
|
||||||
b.iter(|| suffix(&string).unwrap());
|
// b.iter(|| suffix(&string).unwrap());
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[bench]
|
// #[bench]
|
||||||
fn bench_esaxx_long2(b: &mut Bencher) {
|
// fn bench_esaxx_long2(b: &mut Bencher) {
|
||||||
let string = std::fs::read_to_string("data/eighty.txt").unwrap();
|
// let string = std::fs::read_to_string("data/eighty.txt").unwrap();
|
||||||
b.iter(|| suffix(&string).unwrap());
|
// b.iter(|| suffix(&string).unwrap());
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[bench]
|
// #[bench]
|
||||||
fn bench_esaxx_rs_long(b: &mut Bencher) {
|
// fn bench_esaxx_rs_long(b: &mut Bencher) {
|
||||||
let string = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.".to_string();
|
// let string = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.".to_string();
|
||||||
b.iter(|| suffix_rs(&string).unwrap());
|
// b.iter(|| suffix_rs(&string).unwrap());
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[bench]
|
// #[bench]
|
||||||
fn bench_esaxx_rs_long2(b: &mut Bencher) {
|
// fn bench_esaxx_rs_long2(b: &mut Bencher) {
|
||||||
let string = std::fs::read_to_string("data/eighty.txt").unwrap();
|
// let string = std::fs::read_to_string("data/eighty.txt").unwrap();
|
||||||
b.iter(|| suffix_rs(&string).unwrap());
|
// b.iter(|| suffix_rs(&string).unwrap());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user