From c2e2424a84ddfc9c191d00dc5b435bf0315667b7 Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Tue, 25 Jun 2024 12:49:45 -0500 Subject: [PATCH] fix: Only update the redir index on the first column (#5659) JS API full table subscriptions currently spend more time than they should updating redirection indexes for large snapshots. This patch is a small step to reduce the work done when receiving these large payloads. Fixes #5658 --- .../web/client/api/subscription/SubscriptionTableData.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/client-api/src/main/java/io/deephaven/web/client/api/subscription/SubscriptionTableData.java b/web/client-api/src/main/java/io/deephaven/web/client/api/subscription/SubscriptionTableData.java index 84e4dc1c758..7c08d330e91 100644 --- a/web/client-api/src/main/java/io/deephaven/web/client/api/subscription/SubscriptionTableData.java +++ b/web/client-api/src/main/java/io/deephaven/web/client/api/subscription/SubscriptionTableData.java @@ -68,6 +68,7 @@ public TableData handleSnapshot(TableSnapshot snapshot) { long includedRowCount = snapshot.getIncludedRows().size(); RangeSet destination = freeRows(includedRowCount); + boolean indexUpdated = false; for (int index = 0; index < dataColumns.length; index++) { ColumnData dataColumn = dataColumns[index]; @@ -89,10 +90,14 @@ public TableData handleSnapshot(TableSnapshot snapshot) { while (indexIter.hasNext()) { assert destIter.hasNext(); long dest = destIter.nextLong(); - redirectedIndexes.put(indexIter.nextLong(), dest); + long nextIndex = indexIter.nextLong(); + if (!indexUpdated) { + redirectedIndexes.put(nextIndex, dest); + } arrayCopy.copyTo(localCopy, dest, dataColumn.getData(), j++); } assert !destIter.hasNext(); + indexUpdated = true; } return notifyUpdates(index, RangeSet.empty(), RangeSet.empty());