-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #305 from blackbeam/v22.0.0-release
v22.0.0 release
- Loading branch information
Showing
9 changed files
with
232 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#![cfg(not(feature = "buffer-pool"))] | ||
|
||
use std::ops::Deref; | ||
|
||
#[derive(Debug)] | ||
#[repr(transparent)] | ||
pub struct Buffer(Vec<u8>); | ||
|
||
impl AsMut<Vec<u8>> for Buffer { | ||
fn as_mut(&mut self) -> &mut Vec<u8> { | ||
&mut self.0 | ||
} | ||
} | ||
|
||
impl Deref for Buffer { | ||
type Target = [u8]; | ||
|
||
fn deref(&self) -> &Self::Target { | ||
self.0.deref() | ||
} | ||
} | ||
|
||
pub const fn get_buffer() -> Buffer { | ||
Buffer(Vec::new()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2021 Anatoly Ikorsky | ||
// | ||
// Licensed under the Apache License, Version 2.0 | ||
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT | ||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. All files in the project carrying such notice may not be copied, | ||
// modified, or distributed except according to those terms. | ||
|
||
mod disabled; | ||
mod enabled; | ||
|
||
#[cfg(feature = "buffer-pool")] | ||
pub use enabled::{get_buffer, Buffer}; | ||
|
||
#[cfg(not(feature = "buffer-pool"))] | ||
pub use disabled::{get_buffer, Buffer}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
I thought using a Cargo feature to disable buffer-pool would be more robust than using an environment variable but I might have been wrong. Cargo doesn't support disabling a single feature it seems. It's going to be a bit fragile for us to maintain the list of features below for
flate2
andmysql_common
.Given the current cargo design it would be much easier for anyone who want to disable
buffer-pool
if the flag was disabled by default but I see how having it enabled by default can also be beneficial for some/hopefully most users. I guess we will givebuffer-pool
another try and report back if we still observe performance issues.