java - Will Proguard or the Compiler Precalculate TimeUnit.Minutes.toMillis(120) -


currently have class following effectively constant field.

private static final long activity_timeout_ms = 1 * 60 * 1000; 

this fine, still not readable code in world. i'd rather use following:

private static final long activity_timeout_ms = timeunit.minutes.tomillis(1); 

which states want time 1 minute field milliseconds.

my question either compiler or perhaps proguard fix there no performance hit? if there performance hit, can expect 1 time hit per instance of class?

yes, one-time hit on class loading, , such tiny fraction of class loading it's not measurable against overhead of loading class in first place.

no, compiler can't figure out, , surprised if proguard could, doesn't matter.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -