Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

benchmark.hash-sets: adding a benchmark for hash-sets.

  • Loading branch information...
commit cbde9a46432fed2bfcf653057e8ab16842d6cc82 1 parent f938ab0
John Benediktsson authored

Showing 1 changed file with 24 additions and 0 deletions. Show diff stats Hide diff stats

  1. +24 0 extra/benchmark/hash-sets/hash-sets.factor
24 extra/benchmark/hash-sets/hash-sets.factor
... ... @@ -0,0 +1,24 @@
  1 +
  2 +USING: combinators hash-sets kernel math.combinatorics sequences sets ;
  3 +
  4 +IN: benchmark.hash-sets
  5 +
  6 +: make-sets ( -- seq )
  7 + { 10 100 1,000 10,000 100,000 1,000000 } [ iota >hash-set ] map ;
  8 +
  9 +: bench-sets ( seq -- )
  10 + 2 [
  11 + first2 {
  12 + [ union drop ]
  13 + [ intersect drop ]
  14 + [ intersects? drop ]
  15 + [ diff drop ]
  16 + [ set= drop ]
  17 + [ subset? drop ]
  18 + } 2cleave
  19 + ] each-combination ;
  20 +
  21 +: hash-sets-benchmark ( -- )
  22 + make-sets bench-sets ;
  23 +
  24 +MAIN: hash-sets-benchmark

0 comments on commit cbde9a4

Please sign in to comment.
Something went wrong with that request. Please try again.