From 0cd64bfb147e44e00f3b36535c7c68dca8edd143 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Sat, 6 Sep 2014 20:41:13 -0700 Subject: [PATCH] Move the benchmarks into a benches/ directory --- {src => benches}/bench_enum.rs | 13 +++++++++++-- {src => benches}/bench_log.rs | 15 ++++++++++----- {src => benches}/bench_map.rs | 13 +++++++++++-- {src => benches}/bench_struct.rs | 13 +++++++++++-- {src => benches}/bench_vec.rs | 13 +++++++++++-- src/lib.rs | 21 --------------------- 6 files changed, 54 insertions(+), 34 deletions(-) rename {src => benches}/bench_enum.rs (98%) rename {src => benches}/bench_log.rs (99%) rename {src => benches}/bench_map.rs (98%) rename {src => benches}/bench_struct.rs (98%) rename {src => benches}/bench_vec.rs (98%) diff --git a/src/bench_enum.rs b/benches/bench_enum.rs similarity index 98% rename from src/bench_enum.rs rename to benches/bench_enum.rs index 9a98e2ec..ff1a1ae2 100644 --- a/src/bench_enum.rs +++ b/benches/bench_enum.rs @@ -1,8 +1,17 @@ +#![feature(phase)] + +#[phase(plugin)] +extern crate serde_macros; + +extern crate serde; +extern crate serialize; +extern crate test; + use test::Bencher; use serialize::{Decoder, Decodable}; -use de::{Deserializer, Deserializable}; +use serde::de::{Deserializer, Deserializable}; ////////////////////////////////////////////////////////////////////////////// @@ -178,7 +187,7 @@ mod decoder { mod deserializer { use super::{Animal, Dog, Frog, Error, EndOfStream, SyntaxError}; - use de; + use serde::de; enum State { AnimalState(Animal), diff --git a/src/bench_log.rs b/benches/bench_log.rs similarity index 99% rename from src/bench_log.rs rename to benches/bench_log.rs index 3a913698..05acfe21 100644 --- a/src/bench_log.rs +++ b/benches/bench_log.rs @@ -1,5 +1,10 @@ +#![feature(phase, macro_rules)] #![allow(non_camel_case_types)] +#[phase(plugin)] +extern crate serde_macros; + +extern crate serde; extern crate serialize; extern crate test; extern crate time; @@ -8,10 +13,10 @@ use std::io; use std::io::MemWriter; use test::Bencher; -use json; -use de; -use ser::Serializable; -use ser; +use serde::de; +use serde::json; +use serde::ser::Serializable; +use serde::ser; #[deriving(Encodable, Decodable)] #[deriving_serializable] @@ -1229,7 +1234,7 @@ fn bench_manual_my_mem_writer3_escape(b: &mut Bencher) { } fn direct(wr: W, log: &Log) { - use ser::Serializer; + use serde::ser::Serializer; let mut serializer = json::Serializer::new(wr); serializer.serialize_struct_start("Log", 12).unwrap(); diff --git a/src/bench_map.rs b/benches/bench_map.rs similarity index 98% rename from src/bench_map.rs rename to benches/bench_map.rs index c5a3abae..89d82437 100644 --- a/src/bench_map.rs +++ b/benches/bench_map.rs @@ -1,10 +1,19 @@ +#![feature(phase)] + +#[phase(plugin)] +extern crate serde_macros; + +extern crate serde; +extern crate serialize; +extern crate test; + use std::fmt::Show; use std::collections::HashMap; use test::Bencher; use serialize::{Decoder, Decodable}; -use de::{Deserializer, Deserializable}; +use serde::de::{Deserializer, Deserializable}; ////////////////////////////////////////////////////////////////////////////// @@ -164,7 +173,7 @@ mod deserializer { use super::{Error, EndOfStream, SyntaxError}; - use de; + use serde::de; #[deriving(PartialEq, Show)] enum State { diff --git a/src/bench_struct.rs b/benches/bench_struct.rs similarity index 98% rename from src/bench_struct.rs rename to benches/bench_struct.rs index c1b098d9..cc1c177b 100644 --- a/src/bench_struct.rs +++ b/benches/bench_struct.rs @@ -1,9 +1,18 @@ +#![feature(phase)] + +#[phase(plugin)] +extern crate serde_macros; + +extern crate serde; +extern crate serialize; +extern crate test; + use std::collections::HashMap; use test::Bencher; use serialize::{Decoder, Decodable}; -use de::{Deserializer, Deserializable}; +use serde::de::{Deserializer, Deserializable}; ////////////////////////////////////////////////////////////////////////////// @@ -256,7 +265,7 @@ mod decoder { mod deserializer { use std::collections::HashMap; use super::{Outer, Inner, Error, EndOfStream, SyntaxError}; - use de; + use serde::de; enum State { OuterState(Outer), diff --git a/src/bench_vec.rs b/benches/bench_vec.rs similarity index 98% rename from src/bench_vec.rs rename to benches/bench_vec.rs index b526cf6e..10554831 100644 --- a/src/bench_vec.rs +++ b/benches/bench_vec.rs @@ -1,9 +1,18 @@ +#![feature(phase)] + +#[phase(plugin)] +extern crate serde_macros; + +extern crate serde; +extern crate serialize; +extern crate test; + use std::fmt::Show; use test::Bencher; use serialize::{Decoder, Decodable}; -use de::{Deserializer, Deserializable}; +use serde::de::{Deserializer, Deserializable}; ////////////////////////////////////////////////////////////////////////////// @@ -241,7 +250,7 @@ mod deserializer { use super::{Error, EndOfStream, SyntaxError}; - use de; + use serde::de; #[deriving(PartialEq, Show)] enum State { diff --git a/src/lib.rs b/src/lib.rs index bf6cb389..41315e72 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,15 +6,9 @@ #[cfg(test)] extern crate test; -#[phase(plugin, link)] -extern crate log; - #[phase(plugin)] extern crate serde_macros; -#[cfg(test)] -extern crate debug; - #[cfg(test)] extern crate serialize; @@ -25,21 +19,6 @@ pub mod de; pub mod ser; pub mod json; -#[cfg(test)] -pub mod bench_enum; - -#[cfg(test)] -pub mod bench_struct; - -#[cfg(test)] -pub mod bench_vec; - -#[cfg(test)] -pub mod bench_map; - -#[cfg(test)] -pub mod bench_log; - // an inner module so we can use serde_macros. mod serde { pub use de;