Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

13x Performance for Export chatlog, update rust_g to 0.4.6-vorestation #7744

Merged
merged 2 commits into from
Oct 24, 2020
Merged

13x Performance for Export chatlog, update rust_g to 0.4.6-vorestation #7744

merged 2 commits into from
Oct 24, 2020

Conversation

ShadowLarkens
Copy link
Contributor

VOREStation/VOREStation#9246
https://i.tigercat2000.net/2020/10/dreamdaemon_wsdGma3Q7r.png

Profiler indicates that over 5 calls, there was roughly a 13x improvement by simply switching from << file writes to rustg_write_file.

Note: rust_g is no longer optional for this codebase. It's increasingly important for maintaining performance, and by using the generated .dm file from rust_g's build process (which does not allow for optional rust_g) we can keep up to date much more easily.

rust_g 0.4.6-vorestation is just rust_g 0.4.6 with this diff: (I'll bug Lesh to update our VOREStation/rust-g repo after tgstation/rust-g#39 is in)

diff --git a/Cargo.lock b/Cargo.lock
index 38bb2ee..a7bd91b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1532,7 +1532,7 @@ dependencies = [

 [[package]]
 name = "rust-g"
-version = "0.4.6"
+version = "0.4.6-vorestation"
 dependencies = [
  "chrono",
  "dashmap",
diff --git a/Cargo.toml b/Cargo.toml
index 89fd48d..27d078f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
 [package]
 name = "rust-g"
 edition = "2018"
-version = "0.4.6"
+version = "0.4.6-vorestation"
 authors = ["Bjorn Neergaard <bjorn@neersighted.com>"]
 repository = "https://github.com/tgstation/rust-g"
 license-file = "LICENSE"
diff --git a/src/log.rs b/src/log.rs
index 41e86aa..dfc0aa1 100644
--- a/src/log.rs
+++ b/src/log.rs
@@ -1,5 +1,5 @@
 use crate::error::Result;
-use chrono::Utc;
+use chrono::Local;
 use std::{
     cell::RefCell,
     collections::hash_map::{Entry, HashMap},
@@ -31,7 +31,7 @@ byond_fn! { log_write(path, data, ...rest) {
             // write first line, timestamped
             let mut iter = data.split('\n');
             if let Some(line) = iter.next() {
-                write!(file, "[{}] {}\n", Utc::now().format("%F %T%.3f"), line)?;
+                write!(file, "[{}] {}\n", Local::now().format("%FT%T"), line)?;
             }

             // write remaining lines

Note, in order to run rust_g on a linux system, you must have all of these libraries: (Nothing special needed for windows)

libc6:i386
libgcc1:i386
libstdc++6:i386
libssl1.1:i386
g++-7
g++-7-multilib
gcc-multilib
zlib1g:i386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants