Always sort candidates (#10382)
* Always sort candidates * Sort candidates in Rust in Oxide engine Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
This commit is contained in:
parent
e17855b4d4
commit
ed8ff92b03
2 changed files with 13 additions and 14 deletions
|
|
@ -54,7 +54,7 @@ fn parse_all_blobs(blobs: Vec<Vec<u8>>) -> Vec<String> {
|
|||
let input: Vec<_> = blobs.iter().map(|blob| &blob[..]).collect();
|
||||
let input = &input[..];
|
||||
|
||||
input
|
||||
let mut result: Vec<String> = input
|
||||
.par_iter()
|
||||
.map(|input| Extractor::unique(input, Default::default()))
|
||||
.reduce(Default::default, |mut a, b| {
|
||||
|
|
@ -68,5 +68,7 @@ fn parse_all_blobs(blobs: Vec<Vec<u8>>) -> Vec<String> {
|
|||
// to a string.
|
||||
unsafe { String::from_utf8_unchecked(s.to_vec()) }
|
||||
})
|
||||
.collect()
|
||||
.collect();
|
||||
result.sort();
|
||||
result
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,19 +163,16 @@ export default function expandTailwindAtRules(context) {
|
|||
let classCacheCount = context.classCache.size
|
||||
|
||||
env.DEBUG && console.time('Generate rules')
|
||||
// TODO: Sorting is _probably_ slow, but right now it can guarantee the same order. Eventually
|
||||
// we will be able to get rid of this.
|
||||
env.DEBUG && console.time('Sorting candidates')
|
||||
let sortedCandidates =
|
||||
typeof process !== 'undefined' && process.env.JEST_WORKER_ID
|
||||
? new Set(
|
||||
[...candidates].sort((a, z) => {
|
||||
if (a === z) return 0
|
||||
if (a < z) return -1
|
||||
return 1
|
||||
})
|
||||
)
|
||||
: candidates
|
||||
let sortedCandidates = env.OXIDE
|
||||
? candidates
|
||||
: new Set(
|
||||
[...candidates].sort((a, z) => {
|
||||
if (a === z) return 0
|
||||
if (a < z) return -1
|
||||
return 1
|
||||
})
|
||||
)
|
||||
env.DEBUG && console.timeEnd('Sorting candidates')
|
||||
generateRules(sortedCandidates, context)
|
||||
env.DEBUG && console.timeEnd('Generate rules')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue