Skip to content

Commit 3b6145a

Browse files
github-actions[bot]thecrypticaceactions-user
authored
chore: sync with upstream (#5)
* Bump bundled Tailwind CSS version * Improve performance in large files (tailwindlabs#1507) There are two performance improvements here that both come down to caching: - We call `indexToPosition` *a lot*. Every time this is called it takes the string passed in and re-computes the indices every time. There's no need for this so we have a small, module-level LRU cache to store the data. This should eventually be replaced with parsing and storing data up front when files are edited instead of just doing this whenever we receive a request. That would negate the need for a module-level cache. - We call `compile()` and `candidatesToCss` *a lot* as well. This is expected but 90% of the time the classes passed in have already been seen. We take the generated CSS and convert to a PostCSS node because a lot of the implementation uses that internally. There's no need to go through the whole parse -> serialize -> re-parse routine like we are. I've opted to store the compiled PostCSS roots on the `designSystem.storage` object (which will be created when it doesn't exist on old versions) and we'll return clones of those objects every time (since they may get mutated). With this there's only one large-ish block in a left-heavy profile: `findClassListsInHtmlRange`. That is mostly related to the class attribute lexer. Fixing it will require us to scan document and store info about them when they change. We shouldn't need to run the class attribute lexer if the document hasn't changed. Fixing this will require some more work though. Fixes tailwindlabs#1503 --------- Co-authored-by: Jordan Pittman <jordan@cryptica.me> Co-authored-by: GitHub Action <action@github.com>
1 parent a629ea7 commit 3b6145a

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)