Skip to content

[Build Performance] Including yup adds 3 seconds to lib type-checking #46856

Description

Bug Report

In our (private) typescript project that utilizes composite projects, we've been struggling with increasing compile times as more projects have been added. I took a stab at investigating this based on the Performance Tracing Docs. Ultimately I found that consuming yup adds ~3s to each package build (on an M1 MBP). Given we have 100+ composite projects in the repo (not all of which are impacted, since not all import yup), this starts to stack up as a non-trivial increase to build times.

This can be mitigated by setting skipLibCheck to true, but ideally this would be false for complete validation of downstream types.

🔎 Search Terms

performance yup lib type checking

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ and found nothing applicable

⏯ Playground Link

Playground link with relevant code
The above playground link isn't overly useful given this is a performance bug, I've also prepared a minimal repro. https://github.com/berickson1/Playground/tree/master/type-checking-perf

💻 Code

import yup from 'yup'

export function testFunction(): void {
    const yupString = yup.string()
    console.log(yupString);
}

🙁 Actual behavior

Project compile time went from sub-second to over 3s on an M1 MBP to a single project. When using composite projects, this has a larger impact for every package that includes yup.
trace json (2 MB) - Perfetto UI 2021-11-18 at 10 20 26 AM

Trace ZIP:
trace.json.zip

🙂 Expected behavior

Project compile sees a trivial increase when including yup. This could either be managed by 1) improving peformance of type-checking or 2) leveraging a shared in-memory cache for node_module lib types across composite builds

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs InvestigationThis issue needs a team member to investigate its status.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions