|
|
@ -1,10 +1,11 @@
|
|
|
|
#![feature(const_in_array_repeat_expressions)]
|
|
|
|
#![feature(const_in_array_repeat_expressions)]
|
|
|
|
#![feature(const_fn)]
|
|
|
|
#![feature(const_fn)]
|
|
|
|
#![feature(test)]
|
|
|
|
#![cfg_attr(nightly, feature(test))]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
|
|
|
|
|
|
extern crate test;
|
|
|
|
#[cfg(nightly)] extern crate test;
|
|
|
|
|
|
|
|
|
|
|
|
const MAX: usize = 256;
|
|
|
|
const MAX: usize = 256;
|
|
|
|
|
|
|
|
|
|
|
@ -187,6 +188,24 @@ where K: Collapsible
|
|
|
|
None
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V>
|
|
|
|
|
|
|
|
where K: Borrow<Q>,
|
|
|
|
|
|
|
|
Q: Collapsible + Eq
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for page in self.0.iter_mut()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let v = page.search_mut(key);
|
|
|
|
|
|
|
|
match v {
|
|
|
|
|
|
|
|
Some((ref ok, _)) if key.eq(ok.borrow()) => {
|
|
|
|
|
|
|
|
return v.take().map(|(_, v)| v);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
_ => (),
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
None
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn insert(&mut self, key: K, value: V) -> Option<V>
|
|
|
|
pub fn insert(&mut self, key: K, value: V) -> Option<V>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for page in self.0.iter_mut()
|
|
|
|
for page in self.0.iter_mut()
|
|
|
@ -251,7 +270,7 @@ pub fn collapse<T: AsRef<[u8]>>(bytes: T) -> u8
|
|
|
|
mod tests
|
|
|
|
mod tests
|
|
|
|
{
|
|
|
|
{
|
|
|
|
use super::*;
|
|
|
|
use super::*;
|
|
|
|
use test::{Bencher, black_box};
|
|
|
|
#[cfg(nightly)] use test::{Bencher, black_box};
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[test]
|
|
|
|
fn it_works()
|
|
|
|
fn it_works()
|
|
|
@ -276,7 +295,7 @@ mod tests
|
|
|
|
let mut small = Map::new();
|
|
|
|
let mut small = Map::new();
|
|
|
|
let mut hash = HashMap::new();
|
|
|
|
let mut hash = HashMap::new();
|
|
|
|
|
|
|
|
|
|
|
|
let input = r#"Bludgeoning clsql and mariadb until they kind of work
|
|
|
|
let input = r#"こんばんわBludgeoning clsql and mariadb until they kind of work
|
|
|
|
|
|
|
|
|
|
|
|
There are no good mysql connectors for Common Lisp, whatever you decide to use, you're not going to have a good time. clsql is pretty much the best we've got, and since I had such a delightful experience configuring it myself, I hope to smooth the process of getting this shitware up and running with my own little blogpost here.
|
|
|
|
There are no good mysql connectors for Common Lisp, whatever you decide to use, you're not going to have a good time. clsql is pretty much the best we've got, and since I had such a delightful experience configuring it myself, I hope to smooth the process of getting this shitware up and running with my own little blogpost here.
|
|
|
|
connecting to a database
|
|
|
|
connecting to a database
|
|
|
@ -397,6 +416,7 @@ Now the charset for our initial connection should be set to utf8, and we're free
|
|
|
|
assert_eq!(&op1[..], &op2[..]);
|
|
|
|
assert_eq!(&op1[..], &op2[..]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(nightly)]
|
|
|
|
#[bench]
|
|
|
|
#[bench]
|
|
|
|
fn char_smallmap(b: &mut Bencher)
|
|
|
|
fn char_smallmap(b: &mut Bencher)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -421,7 +441,7 @@ stream"#.chars().collect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(nightly)]
|
|
|
|
#[bench]
|
|
|
|
#[bench]
|
|
|
|
fn u8_smallmap(b: &mut Bencher)
|
|
|
|
fn u8_smallmap(b: &mut Bencher)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -440,6 +460,7 @@ stream"#.chars().collect();
|
|
|
|
|
|
|
|
|
|
|
|
use std::collections::HashMap;
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(nightly)]
|
|
|
|
#[bench]
|
|
|
|
#[bench]
|
|
|
|
fn char_map(b: &mut Bencher)
|
|
|
|
fn char_map(b: &mut Bencher)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -465,6 +486,7 @@ stream"#.chars().collect();
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(nightly)]
|
|
|
|
#[bench]
|
|
|
|
#[bench]
|
|
|
|
fn u8_map(b: &mut Bencher)
|
|
|
|
fn u8_map(b: &mut Bencher)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -480,13 +502,13 @@ stream"#.chars().collect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(nightly)]
|
|
|
|
#[bench]
|
|
|
|
#[bench]
|
|
|
|
fn smap_bench(b: &mut Bencher)
|
|
|
|
fn smap_bench(b: &mut Bencher)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let mut small = Map::new();
|
|
|
|
let mut small = Map::new();
|
|
|
|
|
|
|
|
|
|
|
|
let input = r#"Bludgeoning clsql and mariadb until they kind of work
|
|
|
|
let input = r#"こんばんわBludgeoning clsql and mariadb until they kind of work
|
|
|
|
|
|
|
|
|
|
|
|
There are no good mysql connectors for Common Lisp, whatever you decide to use, you're not going to have a good time. clsql is pretty much the best we've got, and since I had such a delightful experience configuring it myself, I hope to smooth the process of getting this shitware up and running with my own little blogpost here.
|
|
|
|
There are no good mysql connectors for Common Lisp, whatever you decide to use, you're not going to have a good time. clsql is pretty much the best we've got, and since I had such a delightful experience configuring it myself, I hope to smooth the process of getting this shitware up and running with my own little blogpost here.
|
|
|
|
connecting to a database
|
|
|
|
connecting to a database
|
|
|
@ -595,12 +617,13 @@ Now the charset for our initial connection should be set to utf8, and we're free
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(nightly)]
|
|
|
|
#[bench]
|
|
|
|
#[bench]
|
|
|
|
fn hmap_bench(b: &mut Bencher)
|
|
|
|
fn hmap_bench(b: &mut Bencher)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let mut small = HashMap::new();
|
|
|
|
let mut small = HashMap::new();
|
|
|
|
|
|
|
|
|
|
|
|
let input = r#"Bludgeoning clsql and mariadb until they kind of work
|
|
|
|
let input = r#"こんばんわBludgeoning clsql and mariadb until they kind of work
|
|
|
|
|
|
|
|
|
|
|
|
There are no good mysql connectors for Common Lisp, whatever you decide to use, you're not going to have a good time. clsql is pretty much the best we've got, and since I had such a delightful experience configuring it myself, I hope to smooth the process of getting this shitware up and running with my own little blogpost here.
|
|
|
|
There are no good mysql connectors for Common Lisp, whatever you decide to use, you're not going to have a good time. clsql is pretty much the best we've got, and since I had such a delightful experience configuring it myself, I hope to smooth the process of getting this shitware up and running with my own little blogpost here.
|
|
|
|
connecting to a database
|
|
|
|
connecting to a database
|
|
|
@ -701,11 +724,8 @@ Now the charset for our initial connection should be set to utf8, and we're free
|
|
|
|
b.iter(|| {
|
|
|
|
b.iter(|| {
|
|
|
|
for ch in input.chars()
|
|
|
|
for ch in input.chars()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if !small.contains_key(&ch) {
|
|
|
|
let counter = small.entry(ch).or_insert(0);
|
|
|
|
small.insert(ch, 0);
|
|
|
|
*counter +=1;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
*small.get_mut(&ch).unwrap() += 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|