Last active
November 18, 2015 18:53
-
-
Save andrewbranch/699d7ec064b006c8d474 to your computer and use it in GitHub Desktop.
One of these is around 10x faster than the other two
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
// filtered is an Immutable.Seq (lazy sequence) with 307 entries | |
let withinCountry = filtered.filter(p => p.get('locations').some(isSameCountry(yourLocation))); | |
let outsideCountry1 = filtered.filter(p => !withinCountry.includes(p)); | |
let outsideCountry2 = filtered.filter(p => !p.get('locations').some(isSameCountry(yourLocation))); | |
let outsideCountry3 = filtered.toSet().subtract(withinCountry); | |
return withinCountry.sort(someWayOfSorting) | |
.concat(outsideCountryN.sort(someOtherWayOfSorting)) | |
.take(10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment