Skip to content

Commit

Permalink
feat/performance improvements (#1)
Browse files Browse the repository at this point in the history
* WIP

* WIP

* remove warnings, everything builds now, tests are re-enabled

* cleanup + use FxHashSet

* remove timing related code

* sort candidates to guarantee consistent order

* update tests to reflect candidate sorting

* sort candidates

This is useful to do in Rust because we can do it in parallel. In Node
we will still sort, but since most things should be sorted already it
means that we don't have to spend too much time there.

Doing this, resulted in ~4ms -> ~0.9ms for sorting in Node.

* use String::from_utf8_unchecked because we already guaranteed valid utf8 when parsing

This gave us a ~10% speedup

* drop withAlpha on `theme`

* only sort for Jest tests

* Try to get a consistent criterion benchmark

* WIP

* WIP

* WIP: batching + FxHashSet

* WIP

* use fastest algorithm so far

* update input fixture with new changes from Tailwind UI

I'll make sure to get proper fixtures in the benchmark folder soon so
that we don't have to deal with this anymore.

* add 1000 generated fixture files

The idea behind these fixtures files is that they are generated based on
the classNames used in our Tailwind UI project without "leaking"
Tailwind UI.

- The fixtures take random class combinations from Tailwind UI and mix
  the class attribute before it was generated.
- The structure of the HTML is also generated.
- For text I've used a UUID.
- We can probably find a way to generate something good on the fly
  without checking these in but it will do for now.
- We can also probably improve them by making them even more "real" in
  the future (by replacing the UUIDs with real data for example)

Checking them in so that we all run the same benchmarks against the same
code.

* use checked in fixtures for benchmarks

* use the middle X files to benchmark with

* refactor

* Pull in tracing

* Work on better candidate parser

* wip

* WIP

* cleanup

* cargo clippy --fix

* cleanup unused dependencies in the CLI

* remove "simple" from benchmark

What the frick does simple even mean?

* Add test case for Ruby arrays

`w[foo]` isn’t a valid candidate part anyway (but @[foo] is) so we can pick up the internal bits as a candidate. Not 100% sure if we want to do this but it seems sensible-ish

* rename NAPI project

* Simplify

* bump @napi-rs/cli

Co-authored-by: Amos Wenger <[email protected]>
Co-authored-by: Jordan Pittman <[email protected]>
  • Loading branch information
3 people authored Nov 25, 2022
1 parent 549c0bb commit 4c8b5da
Show file tree
Hide file tree
Showing 1,039 changed files with 2,217,629 additions and 1,566 deletions.
182 changes: 115 additions & 67 deletions oxide/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions oxide/crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,5 @@ edition = "2021"

[dependencies]
clap = { version = "4.0.18", features = ["derive"] }
itertools = "0.10.5"
log = "0.4"
pretty_env_logger = "0.4.0"
rayon = "1.5.3"
regex = "1"
tailwindcss-core = { path = "../core" }
Loading

0 comments on commit 4c8b5da

Please sign in to comment.