Comments (15)
Thanks for opening an issue! Yes, binary size is a concern for this library, but only with LTO (because it heavily relies on the actual encoding being known at compile time). Are you measuring bloat with full LTO enabled? If yes, could you provide me reproduction steps? There wasn't any heavy benchmarks in that regard and also no CI to check for regressions, so might be a valid issue :-/
from data-encoding.
The reproduction I have is that project, but I don't have enough energy to look into this much further. It uses thin lto, but it's probably a bad idea to rely on LTO in the first place. My suggestion would be to feature-lock each encoding to allow dependents to only enable what they need, avoiding the need to rely on LTO.
from data-encoding.
I'm back from vacation and could take a look. However I'm not able to reproduce. I tried cargo bloat --release
in your repo but I only see:
0.0% 0.1% 16.1KiB data_encoding data_encoding::Encoding::encode_mut
Could you provide me with exact instructions to reproduce (including commit hash). I have an idea that could easily fix the issue but I want to confirm it actually fixes your problem first.
Thanks!
from data-encoding.
My project also gets this for the encoding and decoding function
Relevant usage of the library
#[derive(Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Serialize, Deserialize)]
pub struct PublicKey(pub [u8; 32]);
impl Display for PublicKey {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&HEXLOWER_PERMISSIVE.encode(&self.0))
}
}
impl FromStr for PublicKey {
type Err = RouteWeaverError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(PublicKey(
HEXLOWER_PERMISSIVE
.decode(s.as_bytes())
.map_err(|_| RouteWeaverError::KeyFailedToParse)?
.try_into()
.map_err(|_| RouteWeaverError::KeyFailedToParse)?,
))
}
}
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Serialize, Deserialize, ZeroizeOnDrop)]
pub struct PrivateKey(pub [u8; 32]);
impl Display for PrivateKey {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&HEXLOWER_PERMISSIVE.encode(&self.0))
}
}
impl FromStr for PrivateKey {
type Err = RouteWeaverError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(PrivateKey(
HEXLOWER_PERMISSIVE
.decode(s.as_bytes())
.map_err(|_| RouteWeaverError::KeyFailedToParse)?
.try_into()
.map_err(|_| RouteWeaverError::KeyFailedToParse)?,
))
}
}
It's not the end of the world its just certainly very strange
from data-encoding.
Thanks! I was able to reproduce on your project with cargo bloat -p route-weaver-router --release
. I'll take a look when I get time. I'm quite busy (and a bit sick) at the moment. I'll ping the issue when I have something.
from data-encoding.
Related Issues (20)
- no-std support for macro crate
- Macros Won't Build in no_std HOT 4
- (std -> core)::fmt::Display for DecodeError and DecodeKind HOT 2
- feature `std` leaking when using macro in no_std env HOT 7
- Missing a new line and decode error HOT 2
- Rust 2021 edition is a major, not a "patch" change HOT 6
- Removing dependency on syn HOT 7
- Make `{encode,decode}_len` const fns? HOT 4
- Encode into an "impl std::fmt::Write" and/or "impl std::io::Write" HOT 5
- Breaking change wish list
- Use doc_auto_cfg once stable HOT 2
- Use as_chunks family of functions once stable
- Internal symbols array is publicly exposed and unsound HOT 4
- Deny warnings in rustdoc
- Partial encoding with padding HOT 3
- Question about Specification HOT 6
- Release 2.5.0
- SIMD optimization HOT 4
- feature request - base58 d/encoding HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data-encoding.