Add a profile_traits crate to reduce compile times.

A rebuild after touching components/profile/mem.rs now takes 48 seconds (and
only rebuilds `profile` and `servo`) which is much lower than it used to be.
In comparison, a rebuild after touching components/profile_traits/mem.rs takes
294 seconds and rebuilds many more crates.

This change also removes some unnecessary crate dependencies in `net` and
`net_traits`.
This commit is contained in:
Nicholas Nethercote 2015-04-29 21:36:03 -07:00
parent 826b722202
commit 092507d23c
37 changed files with 269 additions and 225 deletions

View file

@ -17,6 +17,7 @@ dependencies = [
"net_traits 0.0.1",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile 0.0.1",
"profile_traits 0.0.1",
"script 0.0.1",
"script_tests 0.0.1",
"style_tests 0.0.1",
@ -121,7 +122,7 @@ dependencies = [
"net 0.0.1",
"net_traits 0.0.1",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile 0.0.1",
"profile_traits 0.0.1",
"script_traits 0.0.1",
"time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
@ -348,7 +349,7 @@ dependencies = [
"net_traits 0.0.1",
"plugins 0.0.1",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile 0.0.1",
"profile_traits 0.0.1",
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1",
"skia 0.0.20130412 (git+https://github.com/servo/skia?branch=upstream-2014-06-16)",
@ -561,7 +562,7 @@ dependencies = [
"net_traits 0.0.1",
"plugins 0.0.1",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile 0.0.1",
"profile_traits 0.0.1",
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1",
"script_traits 0.0.1",
@ -580,7 +581,7 @@ dependencies = [
"gfx 0.0.1",
"msg 0.0.1",
"net_traits 0.0.1",
"profile 0.0.1",
"profile_traits 0.0.1",
"script_traits 0.0.1",
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@ -674,7 +675,6 @@ dependencies = [
"net_traits 0.0.1",
"openssl 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile 0.0.1",
"regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"regex_macros 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -691,7 +691,6 @@ dependencies = [
"hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"net 0.0.1",
"net_traits 0.0.1",
"profile 0.0.1",
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
@ -703,7 +702,6 @@ dependencies = [
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
"hyper 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile 0.0.1",
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)",
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
@ -809,13 +807,21 @@ name = "profile"
version = "0.0.1"
dependencies = [
"libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"profile_traits 0.0.1",
"regex 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"task_info 0.0.1",
"time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
[[package]]
name = "profile_traits"
version = "0.0.1"
dependencies = [
"time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand"
version = "0.1.4"
@ -862,7 +868,7 @@ dependencies = [
"net_traits 0.0.1",
"plugins 0.0.1",
"png 0.1.0 (git+https://github.com/servo/rust-png)",
"profile 0.0.1",
"profile_traits 0.0.1",
"rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1",
"selectors 0.1.0 (git+https://github.com/servo/rust-selectors)",

View file

@ -67,6 +67,9 @@ path = "../msg"
[dependencies.profile]
path = "../profile"
[dependencies.profile_traits]
path = "../profile_traits"
[dependencies.util]
path = "../util"

View file

@ -26,6 +26,7 @@ extern crate net;
extern crate net_traits;
extern crate msg;
extern crate profile;
extern crate profile_traits;
#[macro_use]
extern crate util;
extern crate script;
@ -52,8 +53,10 @@ use net::resource_task::new_resource_task;
use net_traits::storage_task::StorageTask;
use gfx::font_cache_task::FontCacheTask;
use profile::mem;
use profile::time;
use profile::mem as profile_mem;
use profile::time as profile_time;
use profile_traits::mem;
use profile_traits::time;
use util::opts;
use std::rc::Rc;
@ -92,8 +95,8 @@ impl Browser {
// to deliver the message.
let (compositor_proxy, compositor_receiver) =
WindowMethods::create_compositor_channel(&window);
let time_profiler_chan = time::Profiler::create(opts.time_profiler_period);
let mem_profiler_chan = mem::Profiler::create(opts.mem_profiler_period);
let time_profiler_chan = profile_time::Profiler::create(opts.time_profiler_period);
let mem_profiler_chan = profile_mem::Profiler::create(opts.mem_profiler_period);
let devtools_chan = opts.devtools_port.map(|port| {
devtools::start_server(port)
});