You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2020/12/31 09:58:56 UTC
[sis] 01/01: Add a note about another failed attempt to optimize.
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
commit ce753409cb6242dfc96632671e5cd2e8602508ed
Author: Martin Desruisseaux <ma...@geomatys.com>
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..ddbe362 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 then 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.