[arvados-workbench2] created: 2.6.0-4-g3e18e351
git repository hosting
git at public.arvados.org
Tue May 9 15:09:08 UTC 2023
at 3e18e35172808479d02e02985563d658fec7bb0f (commit)
commit 3e18e35172808479d02e02985563d658fec7bb0f
Author: Stephen Smith <stephen at curii.com>
Date: Tue May 9 10:42:04 2023 -0400
20424: Process io parameter parsing in single loop to optimize performance
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>
diff --git a/src/views/process-panel/process-io-card.tsx b/src/views/process-panel/process-io-card.tsx
index 7da91bc4..c0dcb7f0 100644
--- a/src/views/process-panel/process-io-card.tsx
+++ b/src/views/process-panel/process-io-card.tsx
@@ -588,16 +588,16 @@ export const getIOParamDisplayValue = (auth: AuthState, input: CommandInputParam
const fileArrayMainFiles = ((input as FileArrayCommandInputParameter).value || []);
const firstMainFilePdh = (fileArrayMainFiles.length > 0 && fileArrayMainFiles[0]) ? getResourcePdhUrl(fileArrayMainFiles[0], pdh) : "";
- // Convert each main file into separate arrays of ProcessIOValue to preserve secondaryFile grouping
- const fileArrayValues = fileArrayMainFiles.map((mainFile: File, i): ProcessIOValue[] => {
- const secondaryFiles = ((mainFile as unknown) as FileWithSecondaryFiles)?.secondaryFiles || [];
- return [
+ // Convert each main and secondaryFiles into array of ProcessIOValue preserving ordering
+ let fileArrayValues: ProcessIOValue[] = [];
+ for(let i = 0; i < fileArrayMainFiles.length; i++) {
+ const secondaryFiles = ((fileArrayMainFiles[i] as unknown) as FileWithSecondaryFiles)?.secondaryFiles || [];
+ fileArrayValues.push(
// Pass firstMainFilePdh to secondary files and every main file besides the first to hide pdh if equal
- ...(mainFile ? [fileToProcessIOValue(mainFile, false, auth, pdh, i > 0 ? firstMainFilePdh : "")] : []),
+ ...(fileArrayMainFiles[i] ? [fileToProcessIOValue(fileArrayMainFiles[i], false, auth, pdh, i > 0 ? firstMainFilePdh : "")] : []),
...(secondaryFiles.map(file => fileToProcessIOValue(file, true, auth, pdh, firstMainFilePdh)))
- ];
- // Reduce each mainFile/secondaryFile group into single array preserving ordering
- }).reduce((acc: ProcessIOValue[], mainFile: ProcessIOValue[]) => (acc.concat(mainFile)), []);
+ );
+ }
return fileArrayValues.length ?
fileArrayValues :
commit 4dd738fa98e3726fcd99a37e334b5ea8db4e5ee0
Author: Stephen Smith <stephen at curii.com>
Date: Tue May 9 10:40:20 2023 -0400
20424: Memoize process io card preview to reduce unnecessary re-renders
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>
diff --git a/src/views/process-panel/process-io-card.tsx b/src/views/process-panel/process-io-card.tsx
index 43be9240..7da91bc4 100644
--- a/src/views/process-panel/process-io-card.tsx
+++ b/src/views/process-panel/process-io-card.tsx
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import React, { ReactElement, useState } from 'react';
+import React, { ReactElement, memo, useState } from 'react';
import { Dispatch } from 'redux';
import {
StyleRulesCallback,
@@ -384,7 +384,7 @@ interface ProcessIOPreviewDataProps {
type ProcessIOPreviewProps = ProcessIOPreviewDataProps & WithStyles<CssRules>;
-const ProcessIOPreview = withStyles(styles)(
+const ProcessIOPreview = memo(withStyles(styles)(
({ classes, data, showImagePreview, valueLabel }: ProcessIOPreviewProps) => {
const showLabel = data.some((param: ProcessIOParameter) => param.label);
return <Table className={classes.tableRoot} aria-label="Process IO Preview">
@@ -441,7 +441,7 @@ const ProcessIOPreview = withStyles(styles)(
})}
</TableBody>
</Table >;
- });
+ }));
interface ProcessValuePreviewProps {
value: ProcessIOValue;
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list