[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jdt-core-dev] Fwd: New features for java language and jdk compiler
|
On 12/11/17 14:42, Cristian Lorenzetto wrote:
> 1) the jit compilation might be improved a lot above all for lambda
> management . Lambda calculus is a mathematic theory : it means you
> can foresee in advance the structure of the class. Lambda functions
> might be replaced in the jit with inline functions based on parent
> clousure context. In the most of case you use just functional
> methods with no root lambda clousure context so it is equivalent to
> a inline replacement in the global context (like C inline
> methods). Benchmark instead tells lambda functions are slower
> anonimous classes... this is a grave conceptual error.
Generally speaking, lambdas are inlined and their superstructure is
optimized away where that is possible. It takes some care to write
code which takes advantage of this: if your lambda captures variables
then almost inevitably it'll be necessary tp create an object to hold
the values of those variables. If you're seeing a marked slowdown in
a simple example of a lambda there's probably a reason for for it.
Show your benchmark.
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671