HCL-TECH-SOFTWARE / domino-jnx

Modern Domino Java API based on JNA access to Domino's C API
https://opensource.hcltechsw.com/domino-jnx/
Apache License 2.0
13 stars 3 forks source link

Avoid using LocalDate.now() in the innards conversion #434

Open klehmann opened 1 month ago

klehmann commented 1 month ago

I was just profiling my latest Domino JNA feature "VirtualViews" to rebuild Domino views and the QueryResultsProcessor logic in Java code, when I came across this call tree: image

In my test, I am processing 40.000 fakename docs into a categorized view, so small code changes add up. But I think we should change the innards conversion in JNX as well and replace this line:

final LocalDate utcDate = LocalDate.now().with(JulianFields.JULIAN_DAY, julianDay);

with this:

final LocalDate utcDate = LocalDate.of(1970,1,1).with(JulianFields.JULIAN_DAY, julianDay);

or a similar solution. Looks like the LocalDate.now() function does some timezone stuff internally that is not cheap.

After my change, the call tree looked better.

image