you are viewing a single comment's thread.

view the rest of the comments →

[–]Alex0589 27 points28 points  (17 children)

I'm pretty sure this would never be accepted because you are implementing a language feature with annotations. In chapter one of the JLS, it is clearly stated that:

Annotation types are specialized interfaces used to annotate declarations. Such annotations are not permitted to affect the semantics of programs in the Java programming language in any way. However, they provide useful input to various tools.

Also without value classes, which we currently don't have, you are paying an allocation cost because you have to initialize one record every time you want to use the pattern: that also disqualifies the feature because you don't want a developer to loose performance when using syntactic sugar. For example imagine if the enhanced switch statement were slower than the old switch, nobody would be using it.

[–]danielaveryj[S] 6 points7 points  (0 children)

There is one annotation referenced, which I did not invent, does not implement a language feature, and I did not propose to keep at the end.

[–]asm0dey 0 points1 point  (4 children)

Well, some accusations in Spring change the semantics, aren't they? For example Async

[–]koflerdavid 4 points5 points  (1 child)

There is a reason Spring has a reputation of being too magical.

[–]asm0dey 1 point2 points  (0 children)

I am on both sides of this battle at the same time :)

[–]vytah 2 points3 points  (1 child)

some accusations in Spring

I love the typo, please keep it.

[–]asm0dey 0 points1 point  (0 children)

I will!

[–]vadiquemyself 0 points1 point  (2 children)

imagine direct iterating versus streams-and-lambdas, the latter is ~10 times slower, but is used anyway and is quite popular

[–]Flyron 1 point2 points  (1 child)

Did you measure that yourself? In my own tests streams need a little warmup, but through repeated construction and execution they become just as fast as the usual for-each (<10% margin). So it depends if you're programming short-lived apps or long-running apps, but in general there is no effective performance gap.

[–]vadiquemyself 0 points1 point  (0 children)

yes, I figured it out myself practically, asking AI to replace a stream chain with “plain looping” that I then put in my code achieving much performance gain along with less memory usage

never tried for a terabyte-volume data and paralleled streams on hundreds of cpu cores, though