uschindler commented on code in PR #12731: URL: https://github.com/apache/lucene/pull/12731#discussion_r1375252807
########## lucene/core/src/java20/org/apache/lucene/internal/vectorization/PanamaVectorUtilSupport.java: ########## @@ -77,6 +77,47 @@ final class PanamaVectorUtilSupport implements VectorUtilSupport { VectorizationProvider.TESTS_FORCE_INTEGER_VECTORS || (isAMD64withoutAVX2 == false); } + private static final String MANAGEMENT_FACTORY_CLASS = "java.lang.management.ManagementFactory"; + private static final String HOTSPOT_BEAN_CLASS = "com.sun.management.HotSpotDiagnosticMXBean"; + + // best effort to see if FMA is fast (this is architecture-independent option) + private static boolean hasFastFMA() { + // on ARM cpus, FMA works fine but is a slight slowdown: don't use it. + if (Constants.OS_ARCH.equals("amd64") == false) { + return false; + } + try { + final Class<?> beanClazz = Class.forName(HOTSPOT_BEAN_CLASS); + // we use reflection for this, because the management factory is not part + // of Java 8's compact profile: + final Object hotSpotBean = Review Comment: Ok, thats fine thank for confirming that it works. The "require static" allows access to the module (if available). So it looks like the code works fine. I think my only change I'd suggested is to add the FMA enablement to the logging message as stated above. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org