Hi David, can you share it? Do you have stacktrace of > 200 elements with
4-5 exceptions linked?
Did you test on all jvm (oracle, zulu, java 8-17)?


Le mar. 17 mai 2022 à 04:46, David Blevins <[email protected]> a
écrit :

> > On May 16, 2022, at 10:49 AM, David Blevins <[email protected]>
> wrote:
> >
> > First, thanks for merging that PR.  I really appreciate it.
> >
> >> On May 15, 2022, at 11:55 PM, GitBox <[email protected]> wrote:
> >>
> >>
> >> rmannibucau commented on PR #91:
> >> URL: https://github.com/apache/johnzon/pull/91#issuecomment-1127292848
> >>
> >>  @dblevins FYI here is a test showing the comment I made in the PR to
> explain why current exception handling is not yet release friendly/ready
> (and why I spoke of mutable exception as an option - note that I don't care
> instantiating 3-4 instances but I care about instantiating 2 stack traces
> since they are often very costly in apps so a MapperExceptionBuilder which
> would be a RuntimeException we catch internally and `.build()` to a
> MapperException after having saved the context in the `Mapper` instance or
> alike would perfectly work if you don't want to make `MapperException`
> mutable on user side - which is a very fair point):
> https://github.com/apache/johnzon/commit/c2bf6945c2ca43befa93e15d821e0dee439aa8de#diff-9a970ccae72ea07cf4f226b1066a425fda9d97f48e06f1bc6f12079da28ca2f4R38
> >
> > Can you help me understand the issue with wrapping exceptions when they
> are a subtype of MapperException?
> >
> > If you really wanted to rewrite the code so it uses some sort of mutable
> message, I'd say I wouldn't recommend it, but I wouldn't stand in the way
> either.  I'm just not clear on what issue we're solving.
>
> For my own curiosity I did a test of an exception 100 stacks deep and than
> wrapped it up to 4 times at about 20 stacks apart.
>
> Speedwise, I wasn't able to see a difference.  Even with 1 million
> exceptions, the numbers were randomly going up and down due to
> hotspotting.  I took heap dumps of 10000 thrown exceptions, here's that
> data:
>
> #    element bytes   arrays bytes   bytes
> 0      82,390,000      8,800,048    9,119
> 1      87,780,000      9,600,048    9,738
> 2     108,570,000     12,000,048    12,057
> 3     144,760,000     16,000,048    16,076
> 4     196,350,000     21,600,048    21,795
>
> The difference between wrapping 0 times or 4 times is about 12k if there
> are 100 elements.  This seems minuscule compared to the work we did with
> Snippet and optimizing buffers.
>
> In practice traces aren't that big and we've already got some wrapping, so
> eliminating 1 layer is maybe going to trim out 1k tops.
>
> We're both exceptionally smart (pun always intended), there are many other
> things we could collaborate on that have more impact.  IMO, this one isn't
> worth our time.
>
>
> -David
>
>
>

Reply via email to