8010309 : PlatformLogger: isLoggable performance / waste due to HashMap<Integer, Level> leads to Integer allocations (boxing)

Laurent Bourgès bourges.laurent at gmail.com
Fri Mar 22 10:34:57 UTC 2013


Peter,

You've beaten me! I have been preparing them too ;-) ...
>

Ok I definitely stop working on the code and let you do it.


> I also did some some renames, that I think make the code more consistent:
> - LevelEnum -> Level (the code is not dependent on
> java.util.logging.Level, so the name can be reused, its private anyway)
> - julLevel -> javaLevel (javaLevel / JavaLogger)
> - LevelEnum.forValue -> Level.valueOf (Mandy)
> - JavaLogger.julLevelToEnum -> JavaLogger.javaLevelToLevel
>

For consistency and clarity, I would prefer having following conventions:
- int levelValue (= PlatformLevel as int) and not int level (conflict with
Level enum ...)
- julLevel / julLogger: more explicit than javaLevel / javaLogger (java
means everything  ... but jul means java.util.logging and javaLogger is in
conflict with JavaLogger class)

Other changes (to webrev.05):
> - removed the occurrence counts in switch comments (as per Mandy's
> suggestion)
> - made LoggerProxy and JavaLogger private
> - fixed double-read of volatile LoggerProxy.levelValue in
> LoggerProxy.isLoggable()
> - added static Level.javaLevel(int value) shortcut (Mandy)
>
> I also updated the test to exercise the correctness of mappings.
>

Well done.

cheers,
Laurent



More information about the core-libs-dev mailing list