Performance optimization - #34
Conversation
mzueva
commented
Mar 6, 2026
- Introduce fast mode for sequence match
- Support XLSX file as assay data input
… assay dataset). Introduce "fast mode" that reduces time for sequence matching. Propagate cpu/memory settings from UI.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the application's data processing capabilities by introducing a performance-optimized 'fast mode' for sequence alignment and expanding data input options to include XLSX files. It also provides users with greater control over computational resources and refines internal data handling for improved accuracy. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces two main features: a 'fast mode' for sequence matching to improve performance, and support for XLSX files as assay data input. The changes look good overall. I've added a few comments:
- A suggestion to improve the memory efficiency of the new XLSX to CSV conversion script.
- A fix for the delimiter detection logic in the UI to make it more robust.
- A recommendation to improve code clarity in the Tengo workflow by using a more descriptive variable name to avoid confusion.
Please take a look at the detailed comments.
Note: Security Review did not run due to the size of the PR.
| // so we check the first line of the already-in-memory data buffer. | ||
| if (extension === 'csv' || extension === 'tsv') { | ||
| const firstLine = new TextDecoder().decode(new Uint8Array(data).slice(0, 4096)).split('\n')[0] ?? ''; | ||
| app.model.args.detectedXsvType = firstLine.includes('\t') ? 'tsv' : 'csv'; |
There was a problem hiding this comment.
The current delimiter detection logic firstLine.includes('\t') is not very robust. It will incorrectly identify a CSV file as a TSV if the first line contains a tab character within a field's value. A more reliable approach would be to count the occurrences of tabs and commas and choose the delimiter that appears more frequently.
| app.model.args.detectedXsvType = firstLine.includes('\t') ? 'tsv' : 'csv'; | |
| app.model.args.detectedXsvType = (firstLine.match(/\t/g) || []).length > (firstLine.match(/,/g) || []).length ? 'tsv' : 'csv'; |
| wb = load_workbook(input_file, read_only=True, data_only=True) | ||
| ws = wb[wb.sheetnames[0]] | ||
|
|
||
| rows = list(ws.iter_rows(values_only=True)) |
There was a problem hiding this comment.
Loading all rows into memory with list(ws.iter_rows(values_only=True)) can be inefficient for large XLSX files, potentially causing high memory consumption. This is likely why the workflow allocates 16GiB for this step. To improve performance and reduce memory usage, consider processing the file as a stream. You can iterate over ws.iter_rows() directly and write to the CSV row-by-row, after finding the header by inspecting the first few hundred rows.