-
Notifications
You must be signed in to change notification settings - Fork 102
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
Various updates and improvements! #38
Conversation
if let Some(output_filename) = prep.output_filename { | ||
std::io::copy(&mut response, &mut std::fs::File::create(&output_filename)?)?; | ||
let mut writer = std::io::BufWriter::new(std::fs::File::create(&output_filename)?); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BufWriter
s are usually much better in this situation, unbuffered I/O has a performance penalty.
@@ -20,13 +20,10 @@ extern crate reqwest; | |||
#[cfg(any(feature = "http", feature = "sql"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dunno why we still have extern crate
definitions, we're using Rust 2018 now.
static ref NEXT_ID: std::sync::atomic::AtomicUsize = Default::default(); | ||
} | ||
static POOL: Lazy<DashMap<String, Pool>> = Lazy::new(DashMap::new); | ||
static NEXT_ID: AtomicUsize = AtomicUsize::new(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No clue why an AtomicUsize was in a lazy_static. That was redundant and probably had a tiny performance penalty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems fine
are you waiting for someone else to +1? |
no, I'm just slow |
DashMap
over aRwLock<HashMap>
for SQL pooling.usize
as the key value instead of a string of theusize
once_cell
overlazy_static
- no macros needed.AtomicUsize
used for pool IDs is no longer wrapped in a lazy_static, it's just it's own thing now.codegen-units = 1
to the release profile. This allows the LLVM to optimize the code more, at the cost of multi-threaded compile time.I've done a quick test, SQL appears to work correctly.