Skip to content
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

Internal optimisations #377

Merged
merged 8 commits into from
Jan 8, 2021
Merged

Internal optimisations #377

merged 8 commits into from
Jan 8, 2021

Conversation

jponge
Copy link
Member

@jponge jponge commented Dec 2, 2020

A set of performance-oriented optimisations and cleanups.

@jponge jponge changed the title No-allocation array null value validation Internal optimisations Dec 2, 2020
@jponge
Copy link
Member Author

jponge commented Dec 2, 2020

Todo: add a consolidating summary in the PR description when ready for review

@codecov
Copy link

codecov bot commented Dec 2, 2020

Codecov Report

Merging #377 (3c6f46a) into master (4c9cceb) will increase coverage by 0.16%.
The diff coverage is 92.20%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #377      +/-   ##
============================================
+ Coverage     89.82%   89.99%   +0.16%     
- Complexity     2768     2776       +8     
============================================
  Files           369      370       +1     
  Lines         10597    10624      +27     
  Branches       1298     1304       +6     
============================================
+ Hits           9519     9561      +42     
+ Misses          570      568       -2     
+ Partials        508      495      -13     
Impacted Files Coverage Δ Complexity Δ
...smallrye/mutiny/infrastructure/Infrastructure.java 67.64% <75.00%> (-3.63%) 25.00 <8.00> (+2.00) ⬇️
...rye/mutiny/converters/uni/UniToMultiPublisher.java 88.88% <88.88%> (ø) 2.00 <2.00> (?)
...io/smallrye/mutiny/converters/uni/ToPublisher.java 100.00% <100.00%> (+12.90%) 2.00 <1.00> (-1.00) ⬆️
...o/smallrye/mutiny/helpers/ParameterValidation.java 100.00% <100.00%> (ø) 24.00 <0.00> (ø)
...va/io/smallrye/mutiny/operators/AbstractMulti.java 100.00% <100.00%> (+2.94%) 28.00 <2.00> (ø)
...java/io/smallrye/mutiny/operators/AbstractUni.java 86.20% <100.00%> (ø) 23.00 <1.00> (ø)
...lrye/mutiny/operators/UniSerializedSubscriber.java 92.30% <100.00%> (ø) 15.00 <6.00> (ø)
...mallrye/mutiny/operators/multi/MultiFlatMapOp.java 85.04% <100.00%> (+0.57%) 3.00 <0.00> (ø)
...rye/mutiny/operators/multi/MultiRepeatUntilOp.java 100.00% <100.00%> (ø) 5.00 <0.00> (ø)
...ye/mutiny/operators/multi/MultiRepeatWhilstOp.java 86.20% <100.00%> (+2.87%) 2.00 <0.00> (ø)
... and 19 more

@jponge
Copy link
Member Author

jponge commented Dec 3, 2020

It's ok to fail, it needs #378

@jponge
Copy link
Member Author

jponge commented Dec 7, 2020

Status: currently breaking due to cd92c55 depending on #379

@jponge jponge force-pushed the internal/opto branch 2 times, most recently from c172411 to c97da07 Compare December 9, 2020 16:05
@jponge jponge force-pushed the internal/opto branch 2 times, most recently from 5d603da to 9af5a9d Compare January 4, 2021 16:12
@jponge jponge requested a review from cescoffier January 7, 2021 21:26
@jponge jponge marked this pull request as ready for review January 7, 2021 21:26
@jponge jponge added this to the 0.13.0 milestone Jan 7, 2021
@jponge jponge added the technical-debt Technical debt reduction label Jan 7, 2021
try {
downstream.onNext(item);
} catch (Throwable failure) {
downstream.onError(failure);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we should call onError here, if the failure comes from the downstream. You need to cancel, but I don't think we need to send a second event.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we just do:

if (upstream.getAndSet(CANCELLED) != CANCELLED) {
    if (item != null) {
      downstream.onNext(item);
    }
    downstream.onComplete();
}

then tests fail in UniRepeatTest and UniCastProcessorTest fail.

Handling exceptions as dropped exceptions does not work either, the downstream in these tests does want the error:

if (upstream.getAndSet(CANCELLED) != CANCELLED) {
    if (item != null) {
        try {
            downstream.onNext(item);
        } catch (Throwable failure) {
            Infrastructure.handleDroppedException(failure);
            return;
        }
    }
    downstream.onComplete();
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(basically calling onError does preserve the existing behaviour)

@cescoffier
Copy link
Contributor

cescoffier commented Jan 8, 2021 via email

@cescoffier
Copy link
Contributor

cescoffier commented Jan 8, 2021 via email

@jponge
Copy link
Member Author

jponge commented Jan 8, 2021

Looking into the corresponding operators, looks like they don't handle predicates throwing an exception as they should.

@cescoffier
Copy link
Contributor

cescoffier commented Jan 8, 2021 via email

@cescoffier cescoffier linked an issue Jan 8, 2021 that may be closed by this pull request
@cescoffier cescoffier merged commit a10f731 into master Jan 8, 2021
@cescoffier cescoffier deleted the internal/opto branch January 8, 2021 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical-debt Technical debt reduction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uni repeat operators do not handle predicate exceptions properly
2 participants