Skip to content

Instantly share code, notes, and snippets.

@george-hawkins
Created July 11, 2016 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save george-hawkins/1ecb310d6a4452d5c666fb584087bc29 to your computer and use it in GitHub Desktop.
Save george-hawkins/1ecb310d6a4452d5c666fb584087bc29 to your computer and use it in GitHub Desktop.
def union(that: TweetSet): TweetSet = {
(left union (right union that)) incl elem
// If we have two trees x={{{.a.}b.}c{.d{.e.}}} and y={{{.f.}g.}h{.i{.j.}}} the number of calls to union varies dramatically according to how we order things:
//
// (left union (right union that)) incl elem // calls=5
// (right union (left union that)) incl elem // calls=5
// (right union (that union left)) incl elem // calls=36
// (left union (that union right)) incl elem // calls=33
// (that union (left union right)) incl elem // calls=26
// (that union (right union left)) incl elem // calls=26
//
// left union right union that incl elem // calls=13
// right union left union that incl elem // calls=13
// right union that union left incl elem // calls=56
// left union that union right incl elem // calls=74
// that union left union right incl elem // calls=77
// that union right union left incl elem // calls=90
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment