1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-09-02 17:46:38 +02:00

optimize http message serialization

This commit is contained in:
Nikolay Kim
2018-02-19 17:21:04 -08:00
parent 4d81186059
commit 6ee14efbe2
4 changed files with 61 additions and 14 deletions

View File

@@ -74,6 +74,7 @@ impl SharedMessagePool {
SharedMessagePool(RefCell::new(VecDeque::with_capacity(128)))
}
#[inline]
pub fn get(&self) -> Rc<HttpMessage> {
if let Some(msg) = self.0.borrow_mut().pop_front() {
msg
@@ -82,6 +83,7 @@ impl SharedMessagePool {
}
}
#[inline]
pub fn release(&self, mut msg: Rc<HttpMessage>) {
let v = &mut self.0.borrow_mut();
if v.len() < 128 {