Skip to content

feat: Add parallel entry processing for all platform exporters - #56

Merged
alexey1312 merged 2 commits into
mainfrom
feat/parallel-entry-processing
Feb 11, 2026
Merged

feat: Add parallel entry processing for all platform exporters#56
alexey1312 merged 2 commits into
mainfrom
feat/parallel-entry-processing

Conversation

@alexey1312

Copy link
Copy Markdown
Collaborator

Summary

Add entry-level parallelism (3rd level) to all 12 platform exporters. Entries within the same resource type (icons, images, colors) now process in parallel using a sliding window approach (max 5 concurrent), significantly reducing export time for configs with many entries.

Changes

  • New utility: parallelMapEntries() in ExFigCore/Concurrency/ — sliding window withThrowingTaskGroup, order-preserving, configurable concurrency
  • 12 exporters updated: replaced sequential for entry in entries loops with parallelMapEntries in all iOS/Android/Flutter/Web exporters for colors, icons, and images
  • Spinner suppression: added hasActiveAnimation check in TerminalUI.withSpinner() to prevent spinner interleaving when entries run in parallel (standalone mode only; batch mode already suppressed)
  • Dead code removed: deleted unused EntryProcessor.swift
  • Tests: 7 new tests for parallelMapEntries (empty input, single entry, order preservation, sequential fallback, error propagation, parallel verification, aggregation)
  • CLAUDE.md: documented entry-level parallelism pattern

Safety

  • Each entry writes to unique output paths — no file conflicts
  • Shared RateLimitedClient throttles Figma API globally
  • TerminalUI is Sendable and thread-safe via TerminalOutputManager
  • All ExportContext implementations are Sendable
  • Result ordering preserved; all merge/sum operations are commutative

Test Plan

  • ./bin/mise run build — 0 errors, 0 warnings
  • ./bin/mise run test — 2151 tests passed
  • ./bin/mise run lint — clean
  • ./bin/mise run format-check — clean

Introduce `parallelMapEntries` function to process exporter entries
in parallel, enhancing performance while respecting concurrency limits.
Adapters for Android, Flutter, Web, and iOS exporters now leverage this
improved parallel processing mechanism for colors, icons, and images.

Changes:
- Replace sequential entry processing with parallel processing using
  the new `parallelMapEntries` across all platform exporters.
- Introduce `parallelMapEntries` in `ExFigCore` for general-purpose
  parallel execution with configurable concurrency limits.
- Update `TerminalUI` to suppress spinner display during parallel
  execution, preventing visual conflicts.
- Remove `EntryProcessor.swift`, which handled sequential
  processing, as it is now obsolete.
- Add comprehensive unit tests for `parallelMapEntries`, verifying
  correct order preservation and error handling.

These changes significantly improve export speed by leveraging parallel
execution while maintaining API rate limits and user feedback integrity.
@alexey1312 alexey1312 changed the title Add parallel entry processing for all platform exporters feat: Add parallel entry processing for all platform exporters Feb 11, 2026
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @alexey1312, 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 performance of all platform exporters by introducing entry-level parallelism. By processing individual entries (colors, icons, images) concurrently using a new parallelMapEntries utility with a sliding window approach, the export time for configurations with numerous entries is substantially reduced. This change also includes necessary adjustments to the terminal UI to ensure a smooth user experience during parallel operations and removes deprecated code.

Highlights

  • New Concurrency Utility: Introduced a new parallelMapEntries() utility in ExFigCore/Concurrency/ for processing collections of items concurrently using a sliding window approach, preserving result order and allowing configurable concurrency.
  • Widespread Exporter Parallelization: Integrated parallelMapEntries() into all 12 platform exporters (iOS, Android, Flutter, Web for colors, icons, and images), replacing sequential processing loops to significantly reduce export times.
  • Terminal UI Enhancements: Implemented logic in TerminalUI.withSpinner() to suppress spinner animations when other parallel tasks are active, preventing visual conflicts during concurrent operations.
  • Code Cleanup: Removed the unused and now redundant EntryProcessor.swift file.
  • Comprehensive Testing: Added 7 new unit tests for parallelMapEntries(), covering various scenarios like empty input, single entry, order preservation, error propagation, and parallel performance verification.
  • Documentation Update: Updated CLAUDE.md to document the new entry-level parallelism pattern and provide guidance for its use in exporters.
Changelog
  • CLAUDE.md
    • Documented the new parallelMapEntries() utility and its usage in exporters.
    • Removed EntryProcessor from the list of cross-cutting helpers.
    • Added a guideline for using parallelMapEntries() in new exporters.
  • Sources/ExFig-Android/Export/AndroidColorsExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing color entries.
  • Sources/ExFig-Android/Export/AndroidIconsExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing icon entries.
  • Sources/ExFig-Android/Export/AndroidImagesExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing image entries.
  • Sources/ExFig-Flutter/Export/FlutterColorsExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing color entries.
  • Sources/ExFig-Flutter/Export/FlutterIconsExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing icon entries.
  • Sources/ExFig-Flutter/Export/FlutterImagesExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing image entries.
  • Sources/ExFig-Web/Export/WebColorsExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing color entries.
  • Sources/ExFig-Web/Export/WebIconsExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing icon entries.
  • Sources/ExFig-Web/Export/WebImagesExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing image entries.
  • Sources/ExFig-iOS/Export/iOSColorsExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing color entries.
  • Sources/ExFig-iOS/Export/iOSIconsExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing icon entries.
  • Sources/ExFig-iOS/Export/iOSImagesExporter.swift
    • Replaced the sequential for loop with a call to parallelMapEntries for processing image entries.
  • Sources/ExFigCLI/Shared/EntryProcessor.swift
    • Removed the EntryProcessor enum, as its functionality is now superseded by parallelMapEntries.
  • Sources/ExFigCLI/TerminalUI/TerminalUI.swift
    • Added a check TerminalOutputManager.shared.hasActiveAnimation to suppress spinner animations when other parallel tasks are active.
  • Sources/ExFigCore/Concurrency/ParallelMapEntries.swift
    • Added a new public function parallelMapEntries that processes an array of entries concurrently using a withThrowingTaskGroup and a sliding window approach, preserving order.
  • Tests/ExFigCoreTests/Concurrency/ParallelMapEntriesTests.swift
    • Added new test cases for parallelMapEntries, including empty input, single entry, multiple entries, order preservation, sequential fallback, error propagation, parallel verification, and aggregation.
Activity
  • No human activity (comments, reviews) has occurred on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is an excellent pull request that introduces entry-level parallelism to significantly speed up the export process. The new parallelMapEntries utility is well-designed and thoroughly tested. The changes are applied consistently across all platform exporters, and the related UI fix to prevent spinner interleaving is a thoughtful addition. I have only a few minor suggestions to improve conciseness in the exporter files.

Comment thread Sources/ExFig-Android/Export/AndroidColorsExporter.swift
Comment thread Sources/ExFig-Android/Export/AndroidIconsExporter.swift
Comment thread Sources/ExFig-Android/Export/AndroidImagesExporter.swift
Comment thread Sources/ExFig-Flutter/Export/FlutterColorsExporter.swift
Comment thread Sources/ExFig-Flutter/Export/FlutterIconsExporter.swift
Comment thread Sources/ExFig-Flutter/Export/FlutterImagesExporter.swift
Comment thread Sources/ExFig-Web/Export/WebColorsExporter.swift
Comment thread Sources/ExFig-Web/Export/WebIconsExporter.swift
Comment thread Sources/ExFig-Web/Export/WebImagesExporter.swift
Comment thread Sources/ExFig-iOS/Export/iOSColorsExporter.swift
@alexey1312
alexey1312 merged commit 1824c9a into main Feb 11, 2026
3 checks passed
@alexey1312
alexey1312 deleted the feat/parallel-entry-processing branch February 11, 2026 15:12
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.

1 participant