Skip to content

Instantly share code, notes, and snippets.

@seansawyer
Last active February 8, 2016 21:48
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 seansawyer/afd5d8a9620fe3e8c915 to your computer and use it in GitHub Desktop.
Save seansawyer/afd5d8a9620fe3e8c915 to your computer and use it in GitHub Desktop.
Find numbers in two files full of 10 million random positive integers
$ time shuf -i 1-4294967296 -n 10000000 | sort | uniq - sorted1.txt
real 0m21.387s
user 0m22.700s
sys 0m0.820s
$ time shuf -i 1-4294967296 -n 10000000 | sort | uniq - sorted2.txt
real 0m21.230s
user 0m22.417s
sys 0m0.703s
$ time comm -1 -2 sorted1.txt sorted2.txt > results.txt
real 0m2.697s
user 0m2.643s
sys 0m0.053s
$ wc -l results.txt
23129 results.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment