1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 18:24:05 +02:00

use jemalloc

This commit is contained in:
Robin Appelman 2019-08-29 22:28:38 +02:00
commit 8e39a1ed50
5 changed files with 36 additions and 5 deletions

28
Cargo.lock generated
View file

@ -191,11 +191,35 @@ dependencies = [
"synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "fs_extra"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "0.4.4" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "jemalloc-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "jemallocator"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.3.0" version = "1.3.0"
@ -498,6 +522,7 @@ dependencies = [
"enumflags2 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "enumflags2 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"enumflags2_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "enumflags2_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"err-derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "err-derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"parse-display 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parse-display 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -573,7 +598,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum enumflags2 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8c30a444d141611c4826a1a2e7eba9a494458edf14754945fa37c9c20f6f7563" "checksum enumflags2 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8c30a444d141611c4826a1a2e7eba9a494458edf14754945fa37c9c20f6f7563"
"checksum enumflags2_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e015b3dfedc096cb55cdc5d022d6b4e6b94547212fb94ad2d9ece20bcd88fe3" "checksum enumflags2_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9e015b3dfedc096cb55cdc5d022d6b4e6b94547212fb94ad2d9ece20bcd88fe3"
"checksum err-derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3d8ff65eb6c2fc68e76557239d16f5698fd56603925b89856d3f0f7105fd4543" "checksum err-derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3d8ff65eb6c2fc68e76557239d16f5698fd56603925b89856d3f0f7105fd4543"
"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674"
"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
"checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
"checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" "checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb"
"checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" "checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc"

View file

@ -25,6 +25,7 @@ serde_repr = "0.1"
better-panic = "0.1" better-panic = "0.1"
err-derive = "0.1" err-derive = "0.1"
parse-display = "0.1" parse-display = "0.1"
jemallocator = "0.3"
[dev-dependencies] [dev-dependencies]
pretty_assertions = "0.6" pretty_assertions = "0.6"

View file

@ -3,6 +3,11 @@ use std::fs;
pub use tf_demo_parser::{Demo, DemoParser, Parse, ParseError, ParserState, Result, Stream}; pub use tf_demo_parser::{Demo, DemoParser, Parse, ParseError, ParserState, Result, Stream};
extern crate jemallocator;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
fn main() -> std::result::Result<(), Box<ParseError>> { fn main() -> std::result::Result<(), Box<ParseError>> {
better_panic::install(); better_panic::install();

View file

@ -158,16 +158,14 @@ impl Parse for PacketEntitiesMessage {
let mut entity = let mut entity =
Self::read_enter(&mut data, entity_index, state, base_line as usize)?; Self::read_enter(&mut data, entity_index, state, base_line as usize)?;
let send_table = get_send_table(state, entity.server_class)?; let send_table = get_send_table(state, entity.server_class)?;
let updated_props = Self::read_update(&mut data, send_table, &mut entity.props)?; Self::read_update(&mut data, send_table, &mut entity.props)?;
//entity.apply_update(updated_props);
entities.push(entity); entities.push(entity);
} else if pvs == PVS::Preserve { } else if pvs == PVS::Preserve {
let mut entity = get_entity_for_update(state, entity_index, pvs)?; let mut entity = get_entity_for_update(state, entity_index, pvs)?;
let send_table = get_send_table(state, entity.server_class)?; let send_table = get_send_table(state, entity.server_class)?;
let updated_props = Self::read_update(&mut data, send_table, &mut entity.props)?; Self::read_update(&mut data, send_table, &mut entity.props)?;
// entity.props = updated_props;
entities.push(entity); entities.push(entity);
} else if state.entity_classes.contains_key(&entity_index) { } else if state.entity_classes.contains_key(&entity_index) {

View file

@ -158,7 +158,6 @@ impl ParserState {
let old_index = ent_message.base_line as usize; let old_index = ent_message.base_line as usize;
let new_index = 1 - old_index; let new_index = 1 - old_index;
self.instance_baselines.swap(0, 1); self.instance_baselines.swap(0, 1);
//self.instance_baselines[new_index] = self.instance_baselines[new_index].clone();
for entity in ent_message.entities.iter() { for entity in ent_message.entities.iter() {
self.instance_baselines[new_index] self.instance_baselines[new_index]