-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 03.04.2013 17:03, schrieb Cédric Champeau: > Hi guys, >
Hey Cédric > First of all, sorry if my question looks stupid, but I have > difficulties explaining what I see. I made a small benchmark > for various MethodHandle.invoke* combinations. Of course, > micro-benchmarks are evil, but in that case, I find the > figures quite interesting. Note that I'm not using > invokedynamic instructions anywhere, I'm just "testing" the API > from plain Java. As MethodHandles are promoted as "faster than > reflection", I expected very different results. > > So first, the link: https://gist.github.com/melix/5291792 > > The results I obtain here with openjdk-8-lambda b83 are not > good: > > |Classic for loop[-1] 166ms|| ||InvokeExact[-1] 170ms|| > ||InvokeExact (local method handle)[-1] 3410ms|| > ||bindTo+invokeExact[-1] 6905ms|| > ||insertArgument+invokeExact[-1] 6254ms|| ||invoke[-1] > 60118ms|| ||bindTo+invoke[-1] 80072ms|| > ||insertArgument+invoke[-1] 78337ms|| ||Reflect[-1] 1219ms|| | Are you sure about milliseconds (not nanos?) 80072ms would be ~80 seconds, I really cannot imagine this :-) Cheers Chris > I added the "static final field" version as a suggestion from > Jochen Theodorou, and it does make things much faster, but it's > the *only* case that comes close to regular Java performance. > Any other combination is much slower. I know that invoke() is > supposed to perform type conversions, but is it supposed to be > that slow as compared to invokeExact? What explains the > difference between the local method handle and the static field > version? In theory, using invokedynamic instruction, the method > handle would come from a boostrap method so I could expect the > same performance as the static field version, but if any other > combination than direct invokeExact calls are slower, then it's > not good. So, basically, I'd like to know what I'm missing here > :) > > Thanks for your explanations! > > P.S: Note that order of tests do not matter here, I know I > should not mix things, but I tested with different test > execution order without more success. > > -- Cédric Champeau SpringSource - A Division Of VMware > http://www.springsource.com/ http://twitter.com/CedricChampeau > > > > _______________________________________________ mlvm-dev > mailing list mlvm-dev@openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev > - -- ############################## # A Digital's Life # ############################## Nickname: Noctarius Location: Germany Meet me at: Ohloh: http://www.ohloh.net/accounts/noctarius G+: https://plus.google.com/114622570438626215811 Web: http://www.noctarius.com LinkedIn: http://www.linkedin.com/pub/christoph-engelbert/55/8b8/20 Xing: https://www.xing.com/profile/Christoph_Engelbert Masterbranch: https://masterbranch.com/christoph.engelbert XMPP/Jabber: noctar...@jabber.ccc.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRXFHNAAoJEH/g+YBfahrq11EQAJaTYf+ws4kYFar1K8iog8OG gdccUUVdHLBVMCjuuukMwdGrb7ksFqfkqqZx3zenBpgqqurJt0O07btJqJmQeLUK cvk3L9TPWmfdVMhzsi9hOBuNTbRPIwaagP8tc2lkQfpBTK2NjRfSgc6KXsEitOnx 3faVENOxoAm8x2lOZUiitQ5geodAO8u3SCYfkykda2hr4ZFivEoP75ezIG9v9dj8 JxcvbkD2Ha8NnSmREYtTJlm+TCSmCpptssKymNyHzmM66omcwoLCczW9TCtYJIQM 91RT2yMppWTaDRLz0xy0NLjV8KO3bWTcnARO7w95uggx0rRhGYuenkFk60hvcr0S slZClSbNEEi8Bflhmnl07T9Kxy1togziAKxFEc8lJwWLDn03iWDmnMI+R/RQ/bYn s470CNEsBhwIEQbfG61AUwqGQaEHeIpojk10ml625n5Lv9DGPkvrH5xfCMiXQZ3e wkmNEDFzh1YJBfTvHWWX+yWb1FSRcOTb2q0PHXoXETDsivTZvMVWXH6NyN9HfOQb CSvHCWM+IpTaaAyQSxEq1sbeR0IPj3bZ6TXDWjvladJElb0Ac1LDUyQzRMbCib9D l8QwT9HZEukIdiHMMU7yiCE7ma5mCLVN6kxJ/b8HujmO5OIijmGgErxwrotR7fkm EUGguzbxJ5cjQRgzdQnH =UC8p -----END PGP SIGNATURE----- _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev