Repository navigation
MzMLFile::load: parallel load of indexed mzML with OpenMP - #10728
Merged
timosachsenberg merged 3 commits intoOct 27, 2026
Merged
timosachsenberg merged 3 commits into
timosachsenberg merged 3 commits into
Conversation
Uncompressed indexed mzML without load filters is split at spectrum offsets from the index into byte-balanced chunks (at least 1 MB, up to 4 per thread, at most 32 threads). Each chunk is parsed with the document header and closing tags by a normal MzMLHandler, so metadata and peaks are parsed exactly as in the serial load; chromatograms form one extra chunk. Parts are concatenated in document order. Single-threaded, compressed, unindexed, small or filtered loads, and any index/document count mismatch, keep the serial streaming parse. Co-Authored-By: Claude Opus 5.5 <[email protected]>
timosachsenberg
approved these changes
Oct 26, 2026
Contributor
|
Running Two problems with remote input in
Suggested fix: keep the parallel path to local files, and set the document identifier once, in the serial branch: void MzMLFile::load(const std::string& filename, PeakMap& map)
{
- map.reset();
-
- //set DocumentIdentifier
- if (StringUtils::hasPrefix(filename, "http://") || StringUtils::hasPrefix(filename, "https://") || StringUtils::hasPrefix(filename, "ftp://") || StringUtils::hasPrefix(filename, "s3://"))
- {
- map.setLoadedFileType(FileTypes::MZML);
- map.setLoadedNetFilePath(filename);
- }
- else
- {
- map.setLoadedFileType(filename);
- map.setLoadedFilePath(filename);
- }
-
- if (!loadParallelIndexed_(filename, map))
+ const bool remote = StringUtils::hasPrefix(filename, "http://") || StringUtils::hasPrefix(filename, "https://")
+ || StringUtils::hasPrefix(filename, "ftp://") || StringUtils::hasPrefix(filename, "s3://");
+ // the parallel load reads byte ranges of a local file; remote documents are streamed
+ if (remote || !loadParallelIndexed_(filename, map))
{
map.reset();
- map.setLoadedFileType(filename);
- map.setLoadedFilePath(filename);
+
+ //set DocumentIdentifier
+ if (remote)
+ {
+ map.setLoadedFileType(FileTypes::MZML);
+ map.setLoadedNetFilePath(filename);
+ }
+ else
+ {
+ map.setLoadedFileType(filename);
+ map.setLoadedFilePath(filename);
+ }
+
Internal::MzMLHandler handler(map, filename, getVersion(), *this);
handler.setOptions(options_);
safeParse_(filename, &handler);With this, Generated by Claude Code |
timosachsenberg
marked this pull request as ready for review
October 26, 2026 17:47
This was referenced Oct 27, 2026
timosachsenberg
added a commit
that referenced
this pull request
Oct 27, 2026
… identifier (#10752) #10728 was merged without the fix from its review: the serial fallback reset the map and called setLoadedFileType(filename)/setLoadedFilePath(filename) unconditionally, undoing the remote branch above it. For a URL, setLoadedFileType(filename) sniffs the content and throws FileNotFound, so every s3:// load failed (and every http(s)/ftp load once #10727 is in), and MzMLFile_test's "load from HTTP URL" section got FileNotFound instead of the expected ParseError. With 2+ threads, loadParallelIndexed_ also ran on URLs, which it cannot read (std::ifstream on the URI). Now remote input always takes the streaming parse, and the document identifier is set once, in the serial branch. Claude-Session: https://claude.ai/code/session_0149aXmaayHbZ6MkxFhfzX1D Co-authored-by: Claude <[email protected]>
4 tasks done
timosachsenberg
pushed a commit
that referenced
this pull request
Oct 28, 2026
…file without index MzMLFile probes every uncompressed mzML for an index before a parallel load (#10728) and in hasIndex(), so ordinary mzML loads printed 'Could not find element indexListOffset' when OpenMP had two or more threads. -1 is the documented result for a missing index; IndexedMzMLHandler, the caller that needs one, now reports it instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r
4 tasks done
poshul
pushed a commit
that referenced
this pull request
Oct 29, 2026
* Replace Xerces with libxml2 on OpenMS 3.7 develop * Document develop integration validation and remaining CI blocker * [TEST] Adapt imzML parse-error tests to the current loadSpectraIndex signature develop added the MSExperiment output to ImzMLFile::loadSpectraIndex; the two malformed-input sections from the libxml2 branch still used the old three-argument form and no longer compiled after the merge. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [PERF] libxml2 adapter: decode Latin-1 in bulk, pass UTF-8 names and attributes through Reading mzML spent much of its time converting text rather than parsing: - OpenMS writes ISO-8859-1 declarations, which libxml2 decodes byte by byte. The adapter now detects such a declaration (or an enforced Latin-1 encoding, using libxml2's own name table), forces UTF-8, passes ASCII chunks through unchanged and converts the rest word-wise itself. - Attributes are kept as UTF-8 slices of the parser buffer in a reusable XMLAttributes::NativeStore. UTF-16 values are produced only on access; the XMLHandler attribute helpers copy the UTF-8 value directly. Element names and character data reuse conversion buffers, so a parse no longer allocates per element or attribute. - New opt-in hooks tryOnStartElementUTF8/tryOnEndElementUTF8 (same contract as tryOnCharactersUTF8) let MzMLHandler take UTF-8 tag names without the UTF-8 -> UTF-16 -> UTF-8 round trip. - MzMLHandler drops character data outside <binary> before scanning it, scans <binary> payloads branch-free, and compares tags and accessions against string_view literals instead of strlen-ing C strings. On a 196 MB DDA-like mzML (Linux, 4 cores) full loads take 0.91 s instead of 1.56 s and metadata-only loads 0.84 s instead of 1.39 s; zlib-compressed arrays 1.13 s instead of 1.66 s. Decoded data are identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [PERF] XMLFile: decompress gzip/bzip2/zip input on a read-ahead thread Inflating outer-gzip mzML costs about as much as parsing it, and both ran serially. A helper thread now fills a small queue of 256 KiB blocks while the parser consumes earlier ones; stream exceptions are rethrown to the caller and an early stop (EndParsingSoftly) shuts the helper down. While it runs, the parsing thread starts OpenMP regions with one thread fewer: idle OpenMP workers spin between the handlers' decoding regions and, on all cores, starve the helper (no gain at all otherwise). 196 MB mzML.gz: full load 0.94 s instead of 1.76 s, metadata-only 0.96 s instead of 1.64 s, i.e. as fast as the uncompressed file. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] vcpkg: require libxml2 2.13.5, a version the registry knows "version>=" must name an entry of the vcpkg version database. There is no 2.13.0 port, so every vcpkg-based CI job (all build-and-test jobs and the Linux/Windows wheels) stopped in "vcpkg install". 2.13.5 is the oldest available release meeting the 2.13 minimum; the baseline still selects the newer libxml2 it pins. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] XMLFile: accept large attributes like Xerces, clean libxml2 diagnostics Review follow-ups for the libxml2 SAX reader: - Set XML_PARSE_HUGE with an explicit entity amplification budget, as the mzIdentML and spectrum DOM readers already do. Without it libxml2 rejects attribute values over 10 MB and nesting deeper than 256 levels, which Xerces read (e.g. large UserParam values in idXML/featureXML). - Strip libxml2's trailing line break from parse and validation messages; OpenMS appends the location itself. - Reserve a core for the decompression thread only when OpenMP uses all cores; a lower thread count chosen by the caller is left alone. - Decode element names and text with StringManager::convert instead of a second, non-validating UTF-8 decoder. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [TEST] FileInfo_15: expect libxml2's wording of the mzIdentML schema error The XSD validator now is libxml2. It reports the same single error for the invalid PeptideEvidence@post value ']' on line 327, but words it differently and gives column 0 (Xerces: 183). The whitelist term keyed on Xerces' column no longer matched, so the line with the machine-specific input path was compared literally. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [PERF] mzML cvParams: hash-indexed CV lookups, fewer allocations and string compares MzMLHandler work per cvParam, the most frequent element: - ControlledVocabulary keeps an unordered index next to its ordered term map (whose iteration order is unchanged); getTerm, exists and the ancestry walk of isChildOf use it instead of tree lookups. Copies rebuild the index, moves keep it. A load ran about 580 lookups per spectrum. - cvParamToValue creates the string DataValue only for values that stay strings, not before replacing it with a number. - cvParam/userParam attributes are read into reused buffers; the binaryDataArray branch computes isChildOf once instead of twice. - handleCVParam_ compares "MS:nnnnnnn" accessions as numbers (fixed width) instead of memcmp'ing 347 same-length strings. - XMLAttributes::index rejects names by their first byte before decoding. 196 MB mzML, best of 9: metadata-only loads 0.80-0.82 s instead of 0.89-0.91 s, full loads 0.95-0.96 s instead of 1.06 s; decoded data are identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] Windows: open XML input via to_path, build UTF-8 literal tests with /utf-8 Windows CI (first run of the libxml2 reader there): - XMLFile::parse_ opened files with std::filesystem::u8path, which throws on the code-page file names OpenMS passes around on Windows (File::exists accepts them through to_path). TOPP_FileConverter_nonascii aborted with 0xc0000409. Use to_path, which takes UTF-8 and falls back to the code page. - StringManager_test, XMLHandler_test and XMLParserBackend_test spell UTF-8 text as narrow literals; MSVC encoded them in the build machine's code page (cp1252: "Grüße β ??"), so comparisons failed and a missing lookup segfaulted. Compile these three with /utf-8. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] XMLFile: keep the 64 KiB parse chunk on the heap The libxml2 reader read input into a 64 KiB stack array; Xerces kept its buffers on the heap. Readers run deep in call stacks and on OpenMP worker threads, with 1 MB stacks on Windows. FragmentIndex_test, whose single test function holds ~90 FragmentIndex objects (7 KB each) and loads the modification and enzyme databases from that frame, crashes on Windows CI on this branch (develop: passes); a stack overflow is consistent with it. One allocation per parsed file, no measurable cost. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * fix: warn about same-file parent name mismatches while loading OBO files checkName_() runs while loadFromOBO() is still filling terms_, so it must not look ids up via index_, which is only rebuilt once loading finishes. Also find libxml2's own package config first in OpenMSConfig.cmake for static installations, as the build does, and drop the stale validation section from the migration notes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [DOC] Install: libxml2 >= 2.13 is not packaged on several current distributions Builds without vcpkg take libxml2 from the system. Ubuntu 24.04 and Debian 13 ship 2.9.14, and RHEL, AlmaLinux and Rocky Linux 10 ship 2.12.5, so the configure fails there. Name the minimum version and required features, and point to vcpkg or a source build. The Dockerfile is no longer a pure Ubuntu-packages build; say that it builds libxml2 itself. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h * [TEST] DecompressingInputStream_test: include <algorithm> and Exception.h GCC and Clang on Linux did not find std::min(initializer_list), std::copy_n and the Exception namespace through the other includes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h * [FIX] Remote mzML: no bogus I/O rate; reuse the whole decompression buffer - MzMLHandler reported the load rate from File::fileSize(), which is -1 for remote URIs (develop's #9262), so S3 loads logged an absurd rate. It now reports none when the size is unknown. - DecompressingInputStream refilled only the end of its input buffer after the buffer was consumed; it now starts at the front again. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h * [DOC] Install: without a preset, OPENMS_USE_VCPKG=ON uses the vcpkg submodule's toolchain CMakeLists.txt picks vcpkg/scripts/buildsystems/vcpkg.cmake when the submodule is initialized and no toolchain file is given. An explicit toolchain is only needed without the submodule (source tarballs). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * [FIX] mzML: name CV-typed binary data arrays in one shared helper, for indexed reads too MzMLHandler named arrays typed by a child term of MS:1000513 (binary data array), e.g. ion mobility arrays (MS:1003008), after the term; the indexed decoder (MzMLSpectrumDecoder) did not, so on-disc and indexed reads lost these names and with them the ion mobility data. MzMLHandlerHelper::handleBinaryDataArrayCVParam() now names these arrays (and marks absorbance intensities), and MzMLHandler relies on it. Both paths therefore agree, including the precedence of MzMLHandler: the last array term wins. Accessions missing from the bundled CV stay unidentified instead of throwing. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * MzMLSpectrumDecoder: store m/z and intensity array meta data in the spectrum, as MzMLHandler does Indexed reads dropped the meta data of the default arrays, e.g. the absorbance flag of an intensity array (MS:1000515 with UO:0000269), so writing such a spectrum back to mzML used the wrong intensity unit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * MzMLFile::load: parallel load of indexed mzML with OpenMP (#10728) Uncompressed indexed mzML without load filters is split at spectrum offsets from the index into byte-balanced chunks (at least 1 MB, up to 4 per thread, at most 32 threads). Each chunk is parsed with the document header and closing tags by a normal MzMLHandler, so metadata and peaks are parsed exactly as in the serial load; chromatograms form one extra chunk. Parts are concatenated in document order. Single-threaded, compressed, unindexed, small or filtered loads, and any index/document count mismatch, keep the serial streaming parse. Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Timo Sachsenberg <[email protected]> * MzMLFile::load: keep remote input on the serial path and its document identifier (#10752) #10728 was merged without the fix from its review: the serial fallback reset the map and called setLoadedFileType(filename)/setLoadedFilePath(filename) unconditionally, undoing the remote branch above it. For a URL, setLoadedFileType(filename) sniffs the content and throws FileNotFound, so every s3:// load failed (and every http(s)/ftp load once #10727 is in), and MzMLFile_test's "load from HTTP URL" section got FileNotFound instead of the expected ParseError. With 2+ threads, loadParallelIndexed_ also ran on URLs, which it cannot read (std::ifstream on the URI). Now remote input always takes the streaming parse, and the document identifier is set once, in the serial branch. Claude-Session: https://claude.ai/code/session_0149aXmaayHbZ6MkxFhfzX1D Co-authored-by: Claude <[email protected]> * [FIX] IndexedMzMLDecoder::findIndexListOffset: no error output for a file without index MzMLFile probes every uncompressed mzML for an index before a parallel load (#10728) and in hasIndex(), so ordinary mzML loads printed 'Could not find element indexListOffset' when OpenMP had two or more threads. -1 is the documented result for a missing index; IndexedMzMLHandler, the caller that needs one, now reports it instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [CLEANUP] Remove leftovers of the Xerces migration - CI: the Xerces-removal guard (tools/ci/check_no_xerces.py, its tests and the build step) and -DCMAKE_DISABLE_FIND_PACKAGE_XercesC, which nothing looks for any more. - doc/xml_libxml2_migration.md: notes of the fork's migration (guard commands, links to its benchmark reports); the PR description has the current state. - Xerces API shapes no caller uses: InputStream::getContentType(), CompressedInputSource's char16_t* constructor and getSystemId(), and the global XMLCh alias of the test framework (tests use char16_t). - Stale Xerces mentions: the Xerces valgrind suppression, the devcontainer's dependency list, and comments that compared with Xerces. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [DOC] cmake_findExternalLibs: say which libxml2 installations lack a usable package config Only libxml2's CMake build installs libxml2-config-version.cmake and exported targets. Its autotools and meson builds (distribution packages) install an unversioned libxml2-config.cmake, which find_package(LibXml2 2.13 CONFIG) rejects, so the FindLibXml2 module is used for them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r --------- Co-authored-by: Oliver <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Oliver Kohlbacher <[email protected]>
poshul
pushed a commit
that referenced
this pull request
Oct 29, 2026
* Replace Xerces with libxml2 on OpenMS 3.7 develop * Document develop integration validation and remaining CI blocker * [TEST] Adapt imzML parse-error tests to the current loadSpectraIndex signature develop added the MSExperiment output to ImzMLFile::loadSpectraIndex; the two malformed-input sections from the libxml2 branch still used the old three-argument form and no longer compiled after the merge. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [PERF] libxml2 adapter: decode Latin-1 in bulk, pass UTF-8 names and attributes through Reading mzML spent much of its time converting text rather than parsing: - OpenMS writes ISO-8859-1 declarations, which libxml2 decodes byte by byte. The adapter now detects such a declaration (or an enforced Latin-1 encoding, using libxml2's own name table), forces UTF-8, passes ASCII chunks through unchanged and converts the rest word-wise itself. - Attributes are kept as UTF-8 slices of the parser buffer in a reusable XMLAttributes::NativeStore. UTF-16 values are produced only on access; the XMLHandler attribute helpers copy the UTF-8 value directly. Element names and character data reuse conversion buffers, so a parse no longer allocates per element or attribute. - New opt-in hooks tryOnStartElementUTF8/tryOnEndElementUTF8 (same contract as tryOnCharactersUTF8) let MzMLHandler take UTF-8 tag names without the UTF-8 -> UTF-16 -> UTF-8 round trip. - MzMLHandler drops character data outside <binary> before scanning it, scans <binary> payloads branch-free, and compares tags and accessions against string_view literals instead of strlen-ing C strings. On a 196 MB DDA-like mzML (Linux, 4 cores) full loads take 0.91 s instead of 1.56 s and metadata-only loads 0.84 s instead of 1.39 s; zlib-compressed arrays 1.13 s instead of 1.66 s. Decoded data are identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [PERF] XMLFile: decompress gzip/bzip2/zip input on a read-ahead thread Inflating outer-gzip mzML costs about as much as parsing it, and both ran serially. A helper thread now fills a small queue of 256 KiB blocks while the parser consumes earlier ones; stream exceptions are rethrown to the caller and an early stop (EndParsingSoftly) shuts the helper down. While it runs, the parsing thread starts OpenMP regions with one thread fewer: idle OpenMP workers spin between the handlers' decoding regions and, on all cores, starve the helper (no gain at all otherwise). 196 MB mzML.gz: full load 0.94 s instead of 1.76 s, metadata-only 0.96 s instead of 1.64 s, i.e. as fast as the uncompressed file. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] vcpkg: require libxml2 2.13.5, a version the registry knows "version>=" must name an entry of the vcpkg version database. There is no 2.13.0 port, so every vcpkg-based CI job (all build-and-test jobs and the Linux/Windows wheels) stopped in "vcpkg install". 2.13.5 is the oldest available release meeting the 2.13 minimum; the baseline still selects the newer libxml2 it pins. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] XMLFile: accept large attributes like Xerces, clean libxml2 diagnostics Review follow-ups for the libxml2 SAX reader: - Set XML_PARSE_HUGE with an explicit entity amplification budget, as the mzIdentML and spectrum DOM readers already do. Without it libxml2 rejects attribute values over 10 MB and nesting deeper than 256 levels, which Xerces read (e.g. large UserParam values in idXML/featureXML). - Strip libxml2's trailing line break from parse and validation messages; OpenMS appends the location itself. - Reserve a core for the decompression thread only when OpenMP uses all cores; a lower thread count chosen by the caller is left alone. - Decode element names and text with StringManager::convert instead of a second, non-validating UTF-8 decoder. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [TEST] FileInfo_15: expect libxml2's wording of the mzIdentML schema error The XSD validator now is libxml2. It reports the same single error for the invalid PeptideEvidence@post value ']' on line 327, but words it differently and gives column 0 (Xerces: 183). The whitelist term keyed on Xerces' column no longer matched, so the line with the machine-specific input path was compared literally. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [PERF] mzML cvParams: hash-indexed CV lookups, fewer allocations and string compares MzMLHandler work per cvParam, the most frequent element: - ControlledVocabulary keeps an unordered index next to its ordered term map (whose iteration order is unchanged); getTerm, exists and the ancestry walk of isChildOf use it instead of tree lookups. Copies rebuild the index, moves keep it. A load ran about 580 lookups per spectrum. - cvParamToValue creates the string DataValue only for values that stay strings, not before replacing it with a number. - cvParam/userParam attributes are read into reused buffers; the binaryDataArray branch computes isChildOf once instead of twice. - handleCVParam_ compares "MS:nnnnnnn" accessions as numbers (fixed width) instead of memcmp'ing 347 same-length strings. - XMLAttributes::index rejects names by their first byte before decoding. 196 MB mzML, best of 9: metadata-only loads 0.80-0.82 s instead of 0.89-0.91 s, full loads 0.95-0.96 s instead of 1.06 s; decoded data are identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] Windows: open XML input via to_path, build UTF-8 literal tests with /utf-8 Windows CI (first run of the libxml2 reader there): - XMLFile::parse_ opened files with std::filesystem::u8path, which throws on the code-page file names OpenMS passes around on Windows (File::exists accepts them through to_path). TOPP_FileConverter_nonascii aborted with 0xc0000409. Use to_path, which takes UTF-8 and falls back to the code page. - StringManager_test, XMLHandler_test and XMLParserBackend_test spell UTF-8 text as narrow literals; MSVC encoded them in the build machine's code page (cp1252: "Grüße β ??"), so comparisons failed and a missing lookup segfaulted. Compile these three with /utf-8. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] XMLFile: keep the 64 KiB parse chunk on the heap The libxml2 reader read input into a 64 KiB stack array; Xerces kept its buffers on the heap. Readers run deep in call stacks and on OpenMP worker threads, with 1 MB stacks on Windows. FragmentIndex_test, whose single test function holds ~90 FragmentIndex objects (7 KB each) and loads the modification and enzyme databases from that frame, crashes on Windows CI on this branch (develop: passes); a stack overflow is consistent with it. One allocation per parsed file, no measurable cost. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * fix: warn about same-file parent name mismatches while loading OBO files checkName_() runs while loadFromOBO() is still filling terms_, so it must not look ids up via index_, which is only rebuilt once loading finishes. Also find libxml2's own package config first in OpenMSConfig.cmake for static installations, as the build does, and drop the stale validation section from the migration notes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [DOC] Install: libxml2 >= 2.13 is not packaged on several current distributions Builds without vcpkg take libxml2 from the system. Ubuntu 24.04 and Debian 13 ship 2.9.14, and RHEL, AlmaLinux and Rocky Linux 10 ship 2.12.5, so the configure fails there. Name the minimum version and required features, and point to vcpkg or a source build. The Dockerfile is no longer a pure Ubuntu-packages build; say that it builds libxml2 itself. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h * [TEST] DecompressingInputStream_test: include <algorithm> and Exception.h GCC and Clang on Linux did not find std::min(initializer_list), std::copy_n and the Exception namespace through the other includes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h * [FIX] Remote mzML: no bogus I/O rate; reuse the whole decompression buffer - MzMLHandler reported the load rate from File::fileSize(), which is -1 for remote URIs (develop's #9262), so S3 loads logged an absurd rate. It now reports none when the size is unknown. - DecompressingInputStream refilled only the end of its input buffer after the buffer was consumed; it now starts at the front again. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h * [FEATURE] XMLFile: read HTTP, HTTPS and FTP URLs with libcurl develop read these URLs through Xerces' network transport (#9262), which the libxml2 reader no longer has. HTTPInputSource streams the resource with libcurl's multi interface, driven from readBytes(), so at most one transfer step is buffered. XMLFile reads it through the read-ahead thread, as it does S3 objects and compressed local files, which overlaps network waits with parsing. - gzip and bzip2 content is decompressed (DecompressingInputStream), and HTTP transfer compression is decoded by libcurl. - Redirects are followed, but only to HTTP(S) and FTP. HTTP 4xx/5xx are errors; 404/410 and missing FTP or file resources are FileNotFound. - A transfer slower than 1 byte/s for two minutes fails instead of hanging. - InputStream::cancel() lets the read-ahead thread stop a blocked read when a parse ends early (e.g. a metadata-only load), instead of waiting for a stalled server. libcurl's poll is woken up for it. - The protocol restriction uses only protocols the libcurl build supports, and a transfer whose URL or restriction cannot be set does not start. - CMake requires libcurl 7.66, for curl_multi_poll(). - file:// URLs are accepted by HTTPInputSource, so its class test reads local files through libcurl without network access. The MzMLFile test checks that an unreachable server is a load error, and loads OPENMS_TEST_HTTP_URL when it is set. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L7rXfNq24PfjvsEM7cwX4h * [DOC] Install: without a preset, OPENMS_USE_VCPKG=ON uses the vcpkg submodule's toolchain CMakeLists.txt picks vcpkg/scripts/buildsystems/vcpkg.cmake when the submodule is initialized and no toolchain file is given. An explicit toolchain is only needed without the submodule (source tarballs). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * [FIX] Remote input: no credentials of the URL in log and error messages A URL can carry credentials: user info (ftp://user:password@host/..., s3://key:secret@bucket/...) or a token in the query of a presigned URL. HTTPInputSource::redactURL() drops user info, query and fragment and leaves local file names unchanged. HTTPInputSource, S3InputSource, XMLFile's parse errors, XMLHandler's messages and the ParseError of MzMLFile::load() use it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * [FIX] mzML: name CV-typed binary data arrays in one shared helper, for indexed reads too MzMLHandler named arrays typed by a child term of MS:1000513 (binary data array), e.g. ion mobility arrays (MS:1003008), after the term; the indexed decoder (MzMLSpectrumDecoder) did not, so on-disc and indexed reads lost these names and with them the ion mobility data. MzMLHandlerHelper::handleBinaryDataArrayCVParam() now names these arrays (and marks absorbance intensities), and MzMLHandler relies on it. Both paths therefore agree, including the precedence of MzMLHandler: the last array term wins. Accessions missing from the bundled CV stay unidentified instead of throwing. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * MzMLSpectrumDecoder: store m/z and intensity array meta data in the spectrum, as MzMLHandler does Indexed reads dropped the meta data of the default arrays, e.g. the absorbance flag of an intensity array (MS:1000515 with UO:0000269), so writing such a spectrum back to mzML used the wrong intensity unit. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * MzMLFile::load: parallel load of indexed mzML with OpenMP (#10728) Uncompressed indexed mzML without load filters is split at spectrum offsets from the index into byte-balanced chunks (at least 1 MB, up to 4 per thread, at most 32 threads). Each chunk is parsed with the document header and closing tags by a normal MzMLHandler, so metadata and peaks are parsed exactly as in the serial load; chromatograms form one extra chunk. Parts are concatenated in document order. Single-threaded, compressed, unindexed, small or filtered loads, and any index/document count mismatch, keep the serial streaming parse. Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Timo Sachsenberg <[email protected]> * MzMLFile::load: keep remote input on the serial path and its document identifier (#10752) #10728 was merged without the fix from its review: the serial fallback reset the map and called setLoadedFileType(filename)/setLoadedFilePath(filename) unconditionally, undoing the remote branch above it. For a URL, setLoadedFileType(filename) sniffs the content and throws FileNotFound, so every s3:// load failed (and every http(s)/ftp load once #10727 is in), and MzMLFile_test's "load from HTTP URL" section got FileNotFound instead of the expected ParseError. With 2+ threads, loadParallelIndexed_ also ran on URLs, which it cannot read (std::ifstream on the URI). Now remote input always takes the streaming parse, and the document identifier is set once, in the serial branch. Claude-Session: https://claude.ai/code/session_0149aXmaayHbZ6MkxFhfzX1D Co-authored-by: Claude <[email protected]> * [FEATURE] HTTPInputSource: range reads, so IndexedMzMLDecoder reads the index over HTTP objectSize() (HEAD) and readRange() (range request) mirror S3InputSource's, and IndexedMzMLDecoder uses them for HTTP/HTTPS/FTP URLs as it does for s3://. From a server that ignores the range (200 instead of 206), readRange() skips to the offset itself. The transfer options and the error mapping are shared by the stream and the new single requests. HTTPInputSource_test now also runs a small HTTP server on 127.0.0.1: plain, gzip and bzip2 resources, HTTP 404, MzMLFile::load, objectSize, byte ranges (also from a server that ignores them) and the index of an indexed mzML. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] IndexedMzMLDecoder::findIndexListOffset: no error output for a file without index MzMLFile probes every uncompressed mzML for an index before a parallel load (#10728) and in hasIndex(), so ordinary mzML loads printed 'Could not find element indexListOffset' when OpenMP had two or more threads. -1 is the documented result for a missing index; IndexedMzMLHandler, the caller that needs one, now reports it instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] No URL credentials in Arrow and libcurl diagnostics or binary-data parse errors poshul's review of #10710 (reproduced on this branch): - Arrow's status messages repeat the URI they were given, e.g. for an invalid port, so S3InputSource exposed the access key, secret and query token although it redacted the name it shows itself. HTTPInputSource::redactURLs() redacts every URL inside such a text; S3InputSource passes Arrow's diagnostics and HTTPInputSource libcurl's error messages through it. - MzMLHandler, MzXMLHandler and ImzMLHandler threw ParseErrors for undecodable binary data with the file name as given, and MzMLFile::load rethrows those unchanged. They now use the redacted name. Tests: redactURLs() on Arrow-style messages; an S3 URI with credentials and an invalid port; MzMLFile::load of corrupt binary data from a URL with a password and a token (fails without the handler fix). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] HTTPInputSource: decompress gzip transfer compression as the stream is read libcurl decoded Content-Encoding itself, and it decodes everything one curl_multi_perform() receives at once. For highly compressed content the write callback then buffered far more than one transfer step: a 128 MiB XML document served with Content-Encoding: gzip (190 KiB on the wire) was buffered completely in makeStream(), raising the peak RSS from 36 to 294 MiB. The stream now asks for gzip itself (Accept-Encoding: gzip) with libcurl's content decoding off. The compressed body is recognized by its magic bytes and decompressed by DecompressingInputStream as the parser reads, as a .gz resource is. The same document now reads with a peak RSS of 38 MiB. The test server serves /encoded/ paths with gzip transfer compression when the client accepts it; HTTPInputSource_test checks the content and that it is decompressed by the stream, and MzMLFile::load of such a URL. Also: TEST_FALSE for a boolean check, and [in] tags for all documented parameters of HTTPInputSource. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * [CLEANUP] Remove leftovers of the Xerces migration - CI: the Xerces-removal guard (tools/ci/check_no_xerces.py, its tests and the build step) and -DCMAKE_DISABLE_FIND_PACKAGE_XercesC, which nothing looks for any more. - doc/xml_libxml2_migration.md: notes of the fork's migration (guard commands, links to its benchmark reports); the PR description has the current state. - Xerces API shapes no caller uses: InputStream::getContentType(), CompressedInputSource's char16_t* constructor and getSystemId(), and the global XMLCh alias of the test framework (tests use char16_t). - Stale Xerces mentions: the Xerces valgrind suppression, the devcontainer's dependency list, and comments that compared with Xerces. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JajmMxMmR16NiPzK3mVX2r * [FIX] S3InputSource: finalize S3 at exit also when no object was opened The exit handler that finalizes Arrow's S3 APIs was registered only after the first S3 filesystem was made. A URI that failed before that (e.g. an invalid port, as in S3InputSource_test since b145d05) left S3 initialized but never finalized: Arrow warned at exit, and on macOS the test crashed at exit (SEGFAULT after PASSED). The handler must run before the statics that Arrow creates with its first S3 client are destroyed, so it is registered after them. ensureS3Initialized() now makes that first client right after the initialization (anonymous, it does not connect) and registers the handler then, once, whatever the URI. S3InputSource_test also checks an S3 server that cannot be reached: a client is made after the first one, and the process still exits cleanly. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * [FIX] HTTPInputSource::objectSize: a GET of the first byte instead of HEAD A presigned URL (e.g. of S3 or GCS) is signed for one request method, usually GET, and refuses a HEAD request (403), so objectSize() failed for it and the index of an indexed mzML could not be read. For HTTP(S), objectSize() now requests the first byte (Range: bytes=0-0) and stops the transfer at the first byte of the body: - 206: the size from Content-Range ("bytes 0-0/<size>") - 416: the same ("bytes */<size>"), for an empty resource - 200 (a server that ignores the range): Content-Length - other 4xx/5xx: errors as before (404/410: FileNotFound) FTP and file URLs, also after a redirect from HTTP to FTP, keep a request without body (SIZE). The test server gains a redirect (/moved/, with a body), a URL presigned for GET (/signed/: 403 for HEAD or without the signature), an empty resource and Content-Range in its 416. Tests: objectSize() of each, a redirect for makeStream(), readRange() of a presigned URL. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb * [FIX] Remote input: both compression layers over HTTP; no URL parts in Arrow and libcurl messages Two findings of poshul's review of c0524b1: 1. A server can send a compressed resource (.mzML.gz, .mzML.bz2) with gzip transfer compression. makeStream() decoded by magic bytes once, so it removed only the transfer compression and handed the parser gzip or bzip2 bytes. The response's Content-Encoding is now collected (ResponseHeader, shared with objectSize()'s Content-Range). With gzip transfer compression, makeStream() decompresses that layer first, then the resource's own compression by its magic bytes, as for a local file. A small PeekingInputStream gives the decompressed stream the peek() for that; every layer still decompresses as the stream is read. 2. Arrow can repeat a part of the URI on its own, e.g. "Invalid S3 connection scheme 'MY_SECRET_SCHEME'" for ?scheme=MY_SECRET_SCHEME, which redactURLs(text) cannot recognize. New HTTPInputSource::redactURLs(text, url) also replaces the user name, password, query values and fragment of the URL (as given and percent-decoded) with "***" where they are a whole word of the text. All Arrow messages of S3InputSource and all libcurl messages of HTTPInputSource go through it. Tests: - The test server sends .mzML.gz and .mzML.bz2 with gzip transfer compression (new test files MzMLFile_6_uncompressed.mzML.gz.gz and .mzML.bz2.gz); makeStream() and MzMLFile::load of both match the local files. The check that OpenMS, not libcurl, decodes the transfer compression is now behavioural: corrupt transfer-compressed data is a ParseError (libcurl would report an IOException). - redactURLs(text, url): a query value on its own, user info as given and decoded, the fragment, whole words only, nothing for URLs without such parts or local file names. - S3InputSource_test: the reproduction (an invalid scheme value) is not in the message. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AWyp5bGPCCbyzyBucWrYkb --------- Co-authored-by: Oliver <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Oliver Kohlbacher <[email protected]>
timosachsenberg
pushed a commit
that referenced
this pull request
Nov 2, 2026
…el, RT and precursor m/z filters The parallel load of indexed mzML (#10728) fell back to the serial streaming parse whenever the options had a spectrum filter, which every tool that loads MS1 spectra only has (e.g. FeatureFinderMultiplex, ProteomicsLFQ seeding). The handler of each part applies the filters to each spectrum as the serial parse does, and the parts are concatenated in document order, so the filtered experiment is the one of the serial load. The check that the document agrees with the index (else the caller reparses serially) now counts all <spectrum> elements read, including the ones the filters skip (new MzMLHandler::getSpectraRead()). Indexed mzML of a 2 h Q Exactive DDA run (57,301 spectra, 7,787 MS1), 4 threads, serial -> parallel (each experiment equal to the serial one): MS1 only 2.4 -> 1.0 s, MS2 only 3.1 -> 1.2 s, RT range 2.7 -> 1.0 s, precursor m/z range 3.3 -> 1.3 s, no filter 4.0 -> 1.6 s. New test (no class test reached the parallel path before: the indexed fixtures are smaller than the 1 MB minimum part): an indexed file of 240 MS1/MS2 spectra (about 5 MB, parsed in 5 parts) loaded with 2 and 4 threads, without filter and with MS level, RT, precursor m/z and combined filters, equals the serial load. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmXibbpHJfAZSzxVFff
3 of 4 tasks
timosachsenberg
added a commit
that referenced
this pull request
Nov 3, 2026
…ts; deterministic profile mode; parallel filtered mzML load (#10797) * [PERF] GridBasedClustering: no copies of grid cells and clusters in the nearest-neighbour search Clusters are unchanged (same indices, points, centres and bounding boxes): - ClusteringGrid::getClusters() returned the list of cluster indices of a cell by value. findNearestNeighbour_() calls it for 9 cells per search, so every search allocated a list node per neighbouring cluster. It now returns a const reference (an empty list for a cell without clusters), and findNearestNeighbour_() looks each cell up once instead of twice (isNonEmptyCell() + getClusters()). The cells are kept in a hash map (they are only looked up, never iterated); add/removeCluster() find a cell once. - The centres of the clusters are kept in a vector indexed by cluster index, so the candidates of a search are not looked up in the cluster map. A candidate is looked up only if it is closer and the clusters have a property A (without one, mergeVeto_() never vetoes). - A merged cluster takes the place of the first cluster in the map and moves its point indices and properties B (new GridBasedCluster constructor taking them as rvalues) instead of copying them twice. - MinimumDistance::operator<, the comparison of the distance multiset, is inline. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmXibbpHJfAZSzxVFff * [PERF] SplineInterpolatedPeaks::Navigator: no copy of a spline package per step, binary search for distant positions getNextPos() copied the current SplinePackage (its cubic spline: five vectors) on every call and again for every package it walked over; it now works on references. eval() and getNextPos() check the package used last and its two successors, and otherwise find the package by binary search instead of walking package by package from it. The packages are ordered and separated by gaps (init_() splits sorted positions into them, and CubicSpline2d rejects unsorted ones), so the results are those of the walk for any starting package. New test: on 40 packages, eval() and getNextPos() of positions left of, between, on the borders of, inside and right of the packages, requested in increasing, decreasing and random order, equal those of a fresh navigator. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmXibbpHJfAZSzxVFff * [FIX,PERF] MultiplexFiltering: same profile result for any number of threads; faster peak searches and fewer copies Fix: with profile data and more than one thread, FeatureFinderMultiplex reported different feature intensities from run to run (TOPP test 1 with 4 threads: 5 runs, 5 different featureXML files). MultiplexFilteringProfile::filter() shared one spline navigator per spectrum between the threads that filter the peaks of a spectrum, and Navigator::eval() reads the package it used last twice, so another thread could change it in between and the evaluation returned 0. Every peak now evaluates the splines through navigators of its own. New test: run() on a profile and a centroided input gives the result of one thread with 2, 4 and 8 threads (3 runs each); it fails with the shared navigators. Faster, the results are unchanged: - Peaks are searched from where the previous search on the same spectrum ended (galloping search, then MSSpectrum::MZBegin(begin, mz, end)), per thread, m/z shift and spectrum of the RT band (filterPeakPositions_()) or mass trace and spectrum (blacklistEntries_()): the peaks of a spectrum are filtered in order of m/z. Nearest peak and tolerance as MSSpectrum::findNearest(). - The averagine distribution of a peptide is DIAHelpers::averagineIsotopeDistribution() (cached per element composition) instead of a convolution per peak (and, for profile data, per m/z step of a peak). - White2Original is a vector per spectrum instead of a std::map; the white experiment of a pattern is built in parallel over the spectra, and its spectra are moved, not copied. - filter() moves the result of each pattern into the list of results instead of copying it (all filtered peaks with their satellites); MultiplexFilteredMSExperiment::getPeak() returns a const reference, and addPeak() also takes a peak to move. - filterSpectrum_() keeps its per-spectrum buffer of decisions instead of allocating (and the kernel zeroing) it for every spectrum and pattern; the peaks are scheduled dynamically, in chunks sized to the spectrum; a spectrum of fewer than 64 peaks is filtered on one thread (the serial loop gives the same result). - The satellites of a peak are collected in a vector and added to its multimap only once the pattern is long enough (most peaks fail before). - Profile: the spline interpolations of the spectra are reserved (SplineInterpolatedPeaks is copied, not moved, when the vector grows), and the peak boundaries are moved. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmXibbpHJfAZSzxVFff * [PERF] MultiplexClustering: cluster groups of points separated in m/z on their own, in parallel GridBasedClustering merges a cluster only with clusters centred in its own or a neighbouring grid cell, and a cluster's centre stays within the m/z range of its points. Points of a filter result that are separated by empty grid columns therefore never meet, and the merges within each group are exactly those of clustering all points at once. cluster() now splits each filter result at gaps of 3 or more empty m/z columns (one would do; the margin covers centres rounded a few ulps beyond their points), clusters the groups of all patterns on several threads (each on the grid columns it covers), and puts the clusters together under the indices of their points. The clusters are unchanged. A filter result with a point outside of the grid is clustered as a whole and throws as before. On a 2 h Q Exactive DDA run (7,787 MS1 spectra, unlabelled, charges 2-5) clustering took 50.1 s (serial) before and 1.1 s now with 4 threads (4 s CPU): the small groups also keep the maps and the distance multiset of GridBasedClustering small. The median m/z for the RT scaling is found with std::nth_element instead of sorting all peaks. New test: islands of points separated by 1 to 6 empty columns and a chain over many columns give the clusters of one GridBasedClustering of all points (indices, points, centres, bounding boxes); it fails when the groups are split at every empty column. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmXibbpHJfAZSzxVFff * [PERF] FeatureFinderMultiplexAlgorithm: build the multiplets in parallel, splines only where needed The feature and consensus maps are unchanged: - The multiplets of the clusters of a pattern are built on several threads (in blocks of 4096 clusters) and appended to the maps in the order of the clusters, where the features get their provisional ids and the consensus features their handles, as before. An exception is rethrown after the multiplets before the cluster that threw were appended, as on one thread. - The satellites of a cluster are de-duplicated with a hash set of their indices instead of a scan of all satellites so far for every satellite (quadratic in the size of the cluster), and the clusters and filtered peaks are no longer copied. - The spline interpolations of the mass traces are built only when correctPeptideIntensities_() uses them: for multiplets whose peptides all have an intensity, not for singlets (e.g. the ProteomicsLFQ seeds). - One PeakIntegrator (trapezoid rule; integratePeak() is const) is shared instead of one being set up per cluster, and algorithm:rt_min is read once per map construction. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmXibbpHJfAZSzxVFff * [PERF] MzMLFile::load: parallel load of indexed mzML also with MS level, RT and precursor m/z filters The parallel load of indexed mzML (#10728) fell back to the serial streaming parse whenever the options had a spectrum filter, which every tool that loads MS1 spectra only has (e.g. FeatureFinderMultiplex, ProteomicsLFQ seeding). The handler of each part applies the filters to each spectrum as the serial parse does, and the parts are concatenated in document order, so the filtered experiment is the one of the serial load. The check that the document agrees with the index (else the caller reparses serially) now counts all <spectrum> elements read, including the ones the filters skip (new MzMLHandler::getSpectraRead()). Indexed mzML of a 2 h Q Exactive DDA run (57,301 spectra, 7,787 MS1), 4 threads, serial -> parallel (each experiment equal to the serial one): MS1 only 2.4 -> 1.0 s, MS2 only 3.1 -> 1.2 s, RT range 2.7 -> 1.0 s, precursor m/z range 3.3 -> 1.3 s, no filter 4.0 -> 1.6 s. New test (no class test reached the parallel path before: the indexed fixtures are smaller than the 1 MB minimum part): an indexed file of 240 MS1/MS2 spectra (about 5 MB, parsed in 5 parts) loaded with 2 and 4 threads, without filter and with MS level, RT, precursor m/z and combined filters, equals the serial load. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmXibbpHJfAZSzxVFff * [FIX] MzMLFile::load: report the progress of the parallel load The parallel load of indexed mzML parsed its parts with handlers that report no progress, so a tool showed no 'loading mzML' progress for such files, now also for loads with spectrum filters (e.g. FeatureFinderMultiplex). The parts done are now reported as the progress of the load. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0149aXmXibbpHJfAZSzxVFff --------- Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #10710 (base: its branch).
MzMLFile::loadnow reads indexed mzML in parallel when OpenMP threads are available. This addresses the remaining gap from the scaling run: on ion-mobility data, array decoding dominated and all three builds were within ±10%.How it works
<spectrum>elements + closing tags by a normalMzMLHandlerwith the caller's options. Metadata, decoding, sorting and IM defaults are therefore exactly those of the serial load.</spectrumList>to the index) form one extra chunk. Parts are concatenated in document order..gz/.bz2/.zipinputThe change is limited to
MzMLFile.cpp, plus one protected helper in the header.Correctness
Each file was loaded serially (1 thread) and in parallel (2, 4, 16 and 32 threads) in the same process, and the complete experiments were compared: spectra, chromatograms and
ExperimentalSettings. All six inputs are identical:The benchmark also checks decoded-data fingerprints against #10710 in every cell: all 60 match.
Results
Setup:
-O3.One reader, seconds, #10710 head → this PR:
With one thread the timings are unchanged. #10710 alone tops out at 1.1–1.6× from its OpenMP array decoding, because XML scanning stays serial.
Several readers in one process, 96 threads in total (speed-up vs #10710; above 1 means faster):
Open points
OMP_NUM_THREADS=1.MzMLFile_test,IndexedMzMLFileLoader_test,OnDiscMSExperiment_test,FileHandler_test,MzMLSpectrumDecoder_testandMSDataCachedConsumer_testpass withOMP_NUM_THREADS1 and 16. Their only indexed mzML input is 27 KB, below the 1 MB chunk minimum, so they exercise the serial fallback. A test needs an indexed fixture of a few MB, or a test-only way to lower the minimum.The separate decoder bug found while verifying this (indexed access loses the names of ion-mobility arrays) goes to develop in its own PR.
🤖 Generated with Claude Code