You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "dk2k (via GitHub)" <gi...@apache.org> on 2023/04/10 13:19:35 UTC

[GitHub] [camel] dk2k commented on pull request #9838: Fixed performance related issue "class types should be compared with == or !=, and not with equals()". PR for core

dk2k commented on PR #9838:
URL: https://github.com/apache/camel/pull/9838#issuecomment-1501807670

   @orpiske I suspect some ambiguity here. It's Object.equals(Object) which I changed in this PR. And it Objects.equals(Object, Object) introduced in java 11 - I didn't change these calls. Oracle loves such questions in Java SE exams.
   Dedicated new benchmark: https://gist.github.com/dk2k/505226619b28a693041c1197b427dea4
   
   Sample timings:
   time for Class.equals(Class)          52
   time for Objects.equals(Class, Class) 11
   time for Class == Class               8
   
   time for Class.equals(Class)          90
   time for Objects.equals(Class, Class) 9
   time for Class == Class               8
   
   time for Class.equals(Class)          68
   time for Objects.equals(Class, Class) 9
   time for Class == Class               6
   
   time for Class.equals(Class)          89
   time for Objects.equals(Class, Class) 9
   time for Class == Class               7
   
   So, I think the proposed changes are still relevant. Objects.equals() can be considered an option as well


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org