-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(xod-project, xod-client): tweak memoized selectors to avoid exce…
…ssive recalculations
- Loading branch information
Showing
9 changed files
with
364 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
import * as R from 'ramda'; | ||
|
||
// :: [a] -> Set a | ||
export const toSet = a => new Set(a); | ||
export const setOf = a => new Set(a); | ||
// :: a -> Set [a] -> Boolean | ||
export const inSet = R.curry((v, s) => (s.has && s.has(v)) || false); | ||
// :: StrMap a -> Set a | ||
export const setOfKeys = R.pipe(R.keys, x => new Set(x)); | ||
// :: Set a -> Set a -> Set a | ||
export const diffSet = R.curry((aSet, bSet) => { | ||
const a = Array.from(aSet).filter(x => !inSet(x, bSet)); | ||
const b = Array.from(bSet).filter(x => !inSet(x, aSet)); | ||
return new Set(a.concat(b)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.