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

tools/api: Speed up fmt from 1min to 18s by writing to rustfmt stdin #1254

Merged
merged 3 commits into from
Oct 29, 2021

Commits on Oct 28, 2021

  1. tools: Use forward- instead of backslashes for non-Windows OS-es

    Using forward slashes makes it so that all the tools generate files into
    the proper directories on Linux - otherwise new folders/files with `\\`
    in the name are created, and none of the existing files are properly
    overwritten.
    MarijnS95 committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    e96158e View commit details
    Browse the repository at this point in the history
  2. tools/api: Speed up fmt from 1min to 18s by writing to rustfmt stdin

    This reintroduces the "pipe Rust code through rustfmt before writing to
    disk" code from [microsoft#828] and yields a massive performance improvement for
    running in parallel over all files now, and not having to write, read,
    and write the same files over again.
    
    Unfortunately Rust's `Command` structure does not yet have proper
    support for forwarding stdout to a file (that's not unix-specific),
    though it could possibly be beneficial to write chunks read from stdout
    directly to a file instead of reading the whole lot into memory first.
    
    [microsoft#828]: microsoft#828
    MarijnS95 committed Oct 28, 2021
    Configuration menu
    Copy the full SHA
    3ecd976 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1e0fcfa View commit details
    Browse the repository at this point in the history