-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PreciseClock
implementation for JRE 8 systems
#3198
Comments
Hi @ppkarwasz , if no one is assigned to this issue, can I pick this up? (After writing the openRewrite rule in 2769, did not want to tag the issues' since they are separate.) |
Sure, go ahead! The task itself is rather easy, but it would be nice if you can add a test that shows that modern JREs perform scalar replacement to the public void init(final MutableInstant mutableInstant) {
long epochSecond = ...;
long nano = ...;
mutableInstant.initFromEpochSecond(epochSecond, nano);
} We do use Google's |
@ppkarwasz for testing here, we just do something of this sorts along with allocation-instrumenter and see the effects? Just add the evidence to the PR, if we have good outcome, or should we do something else?
|
@ppkarwasz, I don't know of a way to measure/detect this effect. |
@jaykataria1111, I think we can drop the "hotness" test. |
Hi @ppkarwasz, It seems like overriding the current implementation of
I wonder why, The interesting part is in the context it shows that it is a |
I am not sure, what the delta at the bundle level means, but it is certainly not related to the Java public API. The build failure is probably due to the In this case you should bump the version number to @Export
@Version("2.25.0")
package org.apache.logging.log4j.core.util; |
Hi @ppkarwasz , opened a PR, for the purpose :), Thanks got to know that you have to manually update the version appreciate it! |
Currently Java 8 users do not have access to timestamps with sub-millisecond precision.
The only
PreciseClock
implementation is only available in theSystemClock
implementation for JRE 9+.Since that implementation does not use any JDK 9-specific feature, I propose to:
SystemClock
implementation fromlog4j-core-java9
tolog4j-core
, overriding the current one.init(MutableInstant)
:logging-log4j2/log4j-core-java9/src/main/java/org/apache/logging/log4j/core/util/SystemClock.java
Lines 42 to 44 in 89c9b9f
might create a new
java.time.Instant
instance for each log event, although I am pretty much convinced that the JRE will inline that instance, when the method becomes hot enough.The text was updated successfully, but these errors were encountered: