Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMemory bloat #44
Comments
This comment has been minimized.
This comment has been minimized.
|
@kali has made a very interesting overview over the origin of the 56 bytes: #45 (comment) |
This comment has been minimized.
This comment has been minimized.
withoutboats
commented
Oct 1, 2016
•
|
This doesn't seem like a great comparison - |
This comment has been minimized.
This comment has been minimized.
Regardless of whether And about io::Result: |
This comment has been minimized.
This comment has been minimized.
withoutboats
commented
Oct 2, 2016
OK but you've used a type which has 0 bytes of data for the non-discriminant portion. All you've documented is that the largest variant of the null error chain is 55 bytes. That doesn't mean that the equivalent of |
This comment has been minimized.
This comment has been minimized.
|
Not really an issue, closing. |
Yamakaky
closed this
Nov 17, 2016
This comment has been minimized.
This comment has been minimized.
|
This is a pretty major issue of this crate, as its against the "performance speed ease of use pick three" motto of Rust, by improving ease of use by heavily impairing performance. |
Yamakaky
reopened this
Nov 19, 2016
This comment has been minimized.
This comment has been minimized.
|
The solution would be to make the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
colin-kiegel
commented
Nov 22, 2016
|
If we assume that errors are less likely than the happy path, we can optimize the memory footprint for the happy path if we heap-allocate most of the error payload. If we look at But on the other hand there may be situations where such heap allocations are not desirable, e.g. (i) when errors happen frequently or (ii) when compiling with So maybe |
This comment has been minimized.
This comment has been minimized.
|
Hum, interesting. Any idea for a the syntax? |
This comment has been minimized.
This comment has been minimized.
withoutboats
commented
Nov 22, 2016
|
I think the first question is: do you want this behavior to be controlled by syntax in the macro invocation, or by a crate feature? A crate feature would be easier to implement & IMO probably easier to use (less new syntax to learn), but wouldn't allow you to scope the behavior to an individual invocation. I'm not sure how often people are defining multiple error_chains in their crate, much less they have a need to different performance properties between them. |
This comment has been minimized.
This comment has been minimized.
|
A crate feature would be enough for me, too. Anything that makes the memory footprint smaller :) |
This comment has been minimized.
This comment has been minimized.
colin-kiegel
commented
Nov 22, 2016
|
I think you could start with a crate feature. That should be sufficient in most cases. A syntax could still be introduced later if there is demand and the crate feature would then only set the default behaviour. |
This comment has been minimized.
This comment has been minimized.
withoutboats
commented
Nov 22, 2016
•
|
Someone correct me if we don't guarantee this yet, but I think if you box the error, |
This comment has been minimized.
This comment has been minimized.
|
I started the implementation with the feature, but I get errors like |
This comment has been minimized.
This comment has been minimized.
withoutboats
commented
Nov 22, 2016
•
|
@Yamakaky Have you tried implementing Edit: Looking at all the impls for the error type, you probably will need a tuple struct, because some of them like |
This comment has been minimized.
This comment has been minimized.
|
Oh, cool! |
Yamakaky
added a commit
that referenced
this issue
Nov 22, 2016
This comment has been minimized.
This comment has been minimized.
|
Please review #69 |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
|
Awesome! |
Yamakaky
added a commit
that referenced
this issue
Nov 23, 2016
Yamakaky
added a commit
that referenced
this issue
Nov 23, 2016
Yamakaky
added this to the 1.0 milestone
Jul 25, 2017
This comment has been minimized.
This comment has been minimized.
cgm616
commented
Nov 4, 2017
|
Is there still work to be done on this issue? |
This comment has been minimized.
This comment has been minimized.
willir
commented
Jan 25, 2018
|
Was this feature implemented? If not, why it was abandoned? |
This comment has been minimized.
This comment has been minimized.
|
Honestly, I don't really work on a Rust project anymore, so I haven't been working on error-chain for some time... |
est31 commentedSep 16, 2016
•
edited
The code (basing on the example from the readme)
outputs:
I might be wrong, but isn't
ChainResultjust "yet another enum", which means those 55 extra bytes have to be copied over when returning, even in the success event? That would mean quite a performance overhead over normal Result in hot code, especially where only the Ok case which may be minimal is encountered, no?Maybe the situation can be improved by making the backtrace functionality optional, as in possible to opt out of at compile time?