uschindler commented on PR #12311: URL: https://github.com/apache/lucene/pull/12311#issuecomment-1559669255
> @uschindler > > > Cool thanks. I was about to do the same, my idea was a bit different: Add a normal virtual method "isSupported()" to the interface and implement it returning true for default provider but returning something depending on vector size for panama provider. This would spare two times doing the additional reflection using the lookup. The lookup function would only return the panama provider if it returns true. > > Another approach is to use Lookup#findStaticVarHandle() on `INT_SPECIES_PREF_BIT_SIZE` and read it. This spares catching `Throwable`, which is one of the things I hate about method handles. > > I used a static method to avoid creating the instance if it's never going to be used, feel free to rewrite this. I don't have a strong option on how this is done - just that it is done. :-) > > Also, not a warning, but should we log the Vector bit size? TRACE or INFO or something ? I changed the code to use a varhandle to directly read the static field, this spares all try/catch with throwable. I also added a LOG.fine(). In MMapDirectory we use LOG.info(), maybe we should do the same here. If somebody enabled the vector API heshe should get some feedback about success. -- 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