Skip to content

Rewrite MATLAB functions with matlab.io.xml.dom#346

Closed
Jerry1144 wants to merge 1 commit into
trackmate-sc:masterfrom
Jerry1144:rewrite-in-xml-dom
Closed

Rewrite MATLAB functions with matlab.io.xml.dom#346
Jerry1144 wants to merge 1 commit into
trackmate-sc:masterfrom
Jerry1144:rewrite-in-xml-dom

Conversation

@Jerry1144

Copy link
Copy Markdown

Rewrite with matlab.io.xml.dom.* facilities, avoiding Java heap size problems. One path to #343.

A detour from #345 - trackmateEdges requires one table per track node, but it isn't possible to express a parent node's attribute in XPath 1.0, and calling readtable() once per track is slow (50+h from my 16k track file).

Then, to keep the total memory use in check, all function in the series must adhere to a single path. Apparently memory reuse does not happen across readstruct, readtable, and matlab.io.xml.*, and GC only occurs during inactivity. Thus the total rewrite.

It's possible to mix readtable's trackmateSpots.m into this. Used alone it is 5x faster than walking the dom tree ourselves, but when called by trackmateGraph.m it doubles temp memory usage, and slows things down when memory pressure kicks in.

Rewrite with `matlab.io.xml.dom.*` facilities, avoiding Java heap size problems

Due to shocking inefficiency of `matlab.io.xml.xpath.*`, all XPath expressions
were manually transformed into tree-walking. Behaviors and calling convention
remain the same - had to resort to global variables to pass the parsed XML
around.
@tinevez

tinevez commented Jun 2, 2026

Copy link
Copy Markdown
Member

Thanks! Is it like a complete rewrite? Or can these files be considered an update of the existing ones? In the later case, could overwrite the existing ones so that the PR shows the diff between each version of the files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants