Consider use of Java 8 `LambdaMetafactory` for Afterburner getter/setter access
See original GitHub issueAs per:
https://www.optaplanner.org/blog/2018/01/09/JavaReflectionButMuchFaster.html
it seems like there is a way to actually get near-static access for getters, without (explicit) code generation, using Java 8 added class LambdaMetafactory
. Whether it will actually work out or not remains to be seen – and, if it does, could it actually be added in jackson-databind
? – but seems like a promising lead. While mechanism is probably not enough to cover all code generation needs (field access, constructor calls), getter/setter access is significant on its own.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Method handles and lambda metafactory
Method.invoke() on OpenJDK 8 is 87% slower than direct access. ... change as this new instruction was not used directly by Java just...
Read more >LambdaMetafactory (Java Platform SE 8 )
Indirect access to the behavior specified by the provided MethodHandle proceeds ... The CallSite can be considered a "factory" for function objects and...
Read more >Is there a fast approach to reflective field access?
In case of OpendJDK (and JDKs built atop it), the LambdaMetaFactory generates a mostly ordinary class file (just accessing private member(s) ...
Read more >Java getter/setter used as Lamda's – GhostProgrammer
Once again I'm looking into ways to make coding so much easier. I needed to be able to pass in a Class::get and...
Read more >JavaScriptReplyProxy crashes every time [159824359]
I think it's not OK to use lambdas in production code. ... W/[truncated packagename redacted]: Accessing hidden method Ljava/lang/invoke/LambdaMetafactory ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @cowtowncoder, I am prototyping a new Afterburner that does this: https://github.com/stevenschlansker/jackson-blackbird
Currently, we run this in production with good results, although obviously the approach is very new and requires additional proving out.
Is this something I could contribute to
jackson-modules-base
? It would be nice to have the source in-tree so it does not drift from Jackson versions, and it would make release management easier. Some projects have already expressed interest: https://github.com/jhipster/generator-jhipster/issues/9934@stevenschlansker That sounds good, I appreciate caution wrt first using it, getting module mature and field-tested. That sounds like a good plan to me. With different maven coordinates can easily publish 2.10 version, and later replace “standard” Afterburner when proven stable.