This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new b9edb1f  Add a note about another failed attempt to optimize.
b9edb1f is described below

commit b9edb1fb3863c20314c6a30b84f0cc2576a9ed3b
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Thu Dec 31 10:56:33 2020 +0100

    Add a note about another failed attempt to optimize.
---
 .../internal/processing/image/IsolineTracer.java    | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/internal/processing/image/IsolineTracer.java
 
b/core/sis-feature/src/main/java/org/apache/sis/internal/processing/image/IsolineTracer.java
index 364b186..71af85f 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/internal/processing/image/IsolineTracer.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/internal/processing/image/IsolineTracer.java
@@ -267,6 +267,27 @@ final class IsolineTracer {
          */
         @SuppressWarnings("AssertWithSideEffects")
         final void interpolate() throws TransformException {
+            /*
+             * Note: `interpolateMissingLeftSide()` and 
`interpolateMissingTopSide(…)` should do interpolations
+             * only for cells in the first column and first row respectively. 
We could avoid those method calls
+             * for all other cells if we add two flags in the `isDataAbove` 
bitmask: FIRST_ROW and FIRST_COLUMN.
+             * The switch cases them become something like below:
+             *
+             *     case <bitmask> | FIRST_COLUMN | FIRST_ROW:
+             *     case <bitmask> | FIRST_COLUMN: {
+             *         interpolateMissingLeftSide();
+             *         // Fall through
+             *     }
+             *     case <bitmask> | FIRST_ROW:
+             *     case <bitmask>: {
+             *         // Interpolations on other borders.
+             *         break;
+             *     }
+             *
+             * We tried that approach, but benchmarking on Java 15 suggested a 
small performance decrease
+             * instead than an improvement. It may be worth to try again in 
the future, after advancement
+             * in compiler technology.
+             */
             switch (isDataAbove) {
                 default: {
                     throw new AssertionError(isDataAbove);      // Should 
never happen.

Reply via email to