It turns out, we don't need capabilities of MuCell (or even RefCell).
We don't to have sophisticated interior mutability. We don't ever lend
out references that may be mutated later. Instead, if there is no value
to lend, then we generate the value, require interior mutability to save
the value internally, and then we return a reference. We never ever
change a value once it's been generated. It can be changed, but only via
&mut self methods, where we can safely reason about mutability.
This means we don't need keep borrow checking code at runtime, which
helps performance. We also are able to reduce the amount of unsafe
transmutes. The internal API more safely constrains the usage of unsafe,
enforcing our invariants, instead of shotgunning unsafe usage with Refs
and promising we're doing it correctly.
On a machine with lower memory (1GB):
Before:
test bench_mock_hyper ... bench: 251772 ns/iter (+/- 128445)
After:
test bench_mock_hyper ... bench: 152603 ns/iter (+/- 25928)
On a machine with more memory, weaker CPU:
Before:
test bench_mock_hyper ... bench: 129398 ns/iter (+/- 51740)
After:
test bench_mock_hyper ... bench: 115935 ns/iter (+/- 28555)
Closes #252
24 lines
530 B
TOML
24 lines
530 B
TOML
[package]
|
|
|
|
name = "hyper"
|
|
version = "0.1.10"
|
|
description = "A modern HTTP library."
|
|
readme = "README.md"
|
|
documentation = "http://hyperium.github.io/hyper/hyper/index.html"
|
|
repository = "https://github.com/hyperium/hyper"
|
|
license = "MIT"
|
|
authors = ["Sean McArthur <sean.monstar@gmail.com>",
|
|
"Jonathan Reem <jonathan.reem@gmail.com>"]
|
|
keywords = ["http", "hyper", "hyperium"]
|
|
|
|
[dependencies]
|
|
cookie = "*"
|
|
log = ">= 0.2.0"
|
|
mime = "*"
|
|
openssl = "*"
|
|
rustc-serialize = "*"
|
|
time = "*"
|
|
unicase = "*"
|
|
unsafe-any = "*"
|
|
url = "*"
|