hadoop-mapreduce-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmed Hussein...@ahussein.me>
Subject Re: Java 8 Lambdas
Date Thu, 29 Apr 2021 02:27:27 GMT
Thanks Eric for raising this issue!

The debate about lambda is very complicated and won't be resolved any time

 I don't personally know a lot about the
> performance of lambdas and welcome arguments on behalf of why lambdas

No one probably knows :)
- Lambda performance would depend on the JVM implementation. This changes
- Java8+ features forces lambda. For example,

I believe that we can transform this discussion into specific action items
for future commits:
For instance, a couple of those specifications would be:
- No refactor just for the sake of using Lambda, unless there is a strong
technical justification.
- Usage of lambda in Unit-tests should be fine. If lambda makes the test
more readable, and
  allows passing method references, then this should make the unit-tests.
- We put sample code in the "how-to-contribute" to elaborate "capturing Vs
  lambda expressions and the implications of each type on the performance.
- Without getting into much detail, IMHO, streams should be committed into
the code
  in exceptional cases. The possibility of executing code in parallel makes
  a nightmare. i.e., Usage of ForEach needs to be justified, what does it
bring to the table?

On Tue, Apr 27, 2021 at 3:07 PM Eric Badger
<ebadger@verizonmedia.com.invalid> wrote:

> Hello all,
> I'd like to gauge the community on the usage of lambdas within Hadoop code.
> I've been reviewing a lot of patches recently that either add or modify
> lambdas and I'm beginning to think that sometimes we, as a community, are
> writing lambdas because we can rather than because we should. To me, it
> seems that lambdas often decrease the readability of the code, making it
> more difficult to understand. I don't personally know a lot about the
> performance of lambdas and welcome arguments on behalf of why lambdas
> should be used. An additional argument is that lambdas aren't available in
> Java 7, and branch-2.10 currently supports Java 7. So any code going back
> to branch-2.10 has to be redone upon backporting. Anyway, my main point
> here is to encourage us to rethink whether we should be using lambdas in
> any given circumstance just because we can.
> Eric
> p.s. I'm also happy to accept this as my personal "old man yells at cloud"
> issue if everyone else thinks lambdas are the greatest

Best Regards,

*Ahmed Hussein, PhD*

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message