Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase performance of comments tab #4473

Merged
merged 21 commits into from
Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
77f3643
memoize comment tab data computation and only update component when d…
philippotto Mar 9, 2020
f318712
speed up deriveData in comment tab view by 10x and fix bug in filteri…
philippotto Mar 11, 2020
2dc20b9
update changelog
philippotto Mar 11, 2020
7730625
change css id to camel case
philippotto Mar 11, 2020
abc9cb3
fix linting
philippotto Mar 11, 2020
f7f71eb
some miscellaneous perf improvements
philippotto Mar 25, 2020
4f6c807
remove unused function
philippotto Mar 25, 2020
fe876e2
fix crashing comment popover
philippotto Mar 26, 2020
9497a4b
Merge branch 'master' into comments-perf
philippotto Mar 26, 2020
754ccfc
fix state access
philippotto Mar 26, 2020
a8515a1
Merge branch 'comments-perf' of github.com:scalableminds/webknossos i…
philippotto Mar 26, 2020
72c5334
don't reassign ids on import when tracing is empty
philippotto Mar 26, 2020
d81e70d
Merge branch 'master' into comments-perf
philippotto Mar 26, 2020
4a7b082
remove unused var
philippotto Mar 26, 2020
8a6abb8
Merge branch 'comments-perf' of github.com:scalableminds/webknossos i…
philippotto Mar 26, 2020
dd0b90c
Update frontend/javascripts/oxalis/view/right-menu/comment_tab/commen…
philippotto Mar 30, 2020
b3f274a
Merge branch 'master' into comments-perf
philippotto Mar 30, 2020
6600694
fix needsReassignedIds bug
philippotto Mar 30, 2020
10ed8c1
Merge branch 'master' into comments-perf
philippotto Mar 30, 2020
84e3971
Merge branch 'master' into comments-perf
MichaelBuessemeyer Mar 30, 2020
8d04784
Merge branch 'master' into comments-perf
philippotto Mar 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).

### Changed
- Reported datasets can now overwrite existing ones that are reported as missing, this ignores the isScratch precedence. [#4465](https://github.com/scalableminds/webknossos/pull/4465)
- Improved the performance for large skeleton tracings with lots of comments. [#4473](https://github.com/scalableminds/webknossos/pull/4473)
- Users can now input floating point numbers into the rotation field in flight and oblique mode. These values will get rounded internally. [#4507](https://github.com/scalableminds/webknossos/pull/4507)
- Deleting an empty tree group in the `Trees` tab no longer prompts for user confirmation. [#4506](https://github.com/scalableminds/webknossos/pull/4506)

Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/oxalis/geometries/cube.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
type Vector3,
} from "oxalis/constants";
import { getPosition } from "oxalis/model/accessors/flycam_accessor";
import Store from "oxalis/store";
import Store from "oxalis/throttled_store";
import app from "app";
import dimensions from "oxalis/model/dimensions";

Expand Down
13 changes: 6 additions & 7 deletions frontend/javascripts/oxalis/model/helpers/nml_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,6 @@ function _parseEntities(obj: Object, key: string): string {
return Saxophone.parseEntities(obj[key]);
}

function findTreeByNodeId(trees: TreeMap, nodeId: number): ?Tree {
return _.values(trees).find(tree => tree.nodes.has(nodeId));
}

function isTreeConnected(tree: Tree): boolean {
const seenNodes = new Map();

Expand Down Expand Up @@ -442,6 +438,7 @@ export function parseNml(
let currentTree: ?Tree = null;
let currentGroup: ?TreeGroup = null;
const groupIdToParent: { [number]: ?TreeGroup } = {};
const nodeIdToTreeId = {};
let datasetName = null;
parser
.on("tagopen", node => {
Expand Down Expand Up @@ -475,8 +472,9 @@ export function parseNml(
break;
}
case "node": {
const nodeId = _parseInt(attr, "id");
const currentNode = {
id: _parseInt(attr, "id"),
id: nodeId,
position: [_parseFloat(attr, "x"), _parseFloat(attr, "y"), _parseFloat(attr, "z")],
rotation: [
_parseFloat(attr, "rotX", DEFAULT_ROTATION[0]),
Expand All @@ -494,6 +492,7 @@ export function parseNml(
throw new NmlParseError(`${messages["nml.node_outside_tree"]} ${currentNode.id}`);
if (existingNodeIds.has(currentNode.id))
throw new NmlParseError(`${messages["nml.duplicate_node_id"]} ${currentNode.id}`);
nodeIdToTreeId[nodeId] = currentTree.treeId;
currentTree.nodes.mutableSet(currentNode.id, currentNode);
existingNodeIds.add(currentNode.id);
break;
Expand Down Expand Up @@ -534,7 +533,7 @@ export function parseNml(
nodeId: _parseInt(attr, "node"),
content: _parseEntities(attr, "content"),
};
const tree = findTreeByNodeId(trees, currentComment.nodeId);
const tree = trees[nodeIdToTreeId[currentComment.nodeId]];
if (tree == null)
throw new NmlParseError(
`${messages["nml.comment_without_tree"]} ${currentComment.nodeId}`,
Expand All @@ -547,7 +546,7 @@ export function parseNml(
nodeId: _parseInt(attr, "id"),
timestamp: _parseInt(attr, "time", DEFAULT_TIMESTAMP),
};
const tree = findTreeByNodeId(trees, currentBranchpoint.nodeId);
const tree = trees[nodeIdToTreeId[currentBranchpoint.nodeId]];
if (tree == null)
throw new NmlParseError(
`${messages["nml.branchpoint_without_tree"]} ${currentBranchpoint.nodeId}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@ export function addTreesAndGroups(
const { allowUpdate } = restrictions;

if (allowUpdate) {
const needsReassignedIds = Object.keys(skeletonTracing.trees).length > 0;

if (!needsReassignedIds) {
// Without reassigning ids, the code is considerably faster.
const newMaxNodeId = getMaximumNodeId(trees);
return Maybe.Just([trees, treeGroups, newMaxNodeId]);
}

// Check whether any group ids collide and assign new ids
const groupIdMap = {};
let nextGroupId = getMaximumGroupId(skeletonTracing.treeGroups) + 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ type CommentProps = {
style: Object,
};

export const commentListId = "commentList";

function ActiveCommentPopover({
comment,
children,
Expand All @@ -41,7 +43,7 @@ function ActiveCommentPopover({
visible
autoAdjustOverflow={false}
placement="rightTop"
getPopupContainer={() => document.getElementById("comment-list")}
getPopupContainer={() => document.getElementById(commentListId)}
style={{ maxHeight: 200, overflowY: "auto" }}
>
{children}
Expand Down
Loading