bloom-lang / bud

Prototype Bud runtime (Bloom Under Development)
http://bloom-lang.net
Other
857 stars 59 forks source link

Consider memoizing TupleStruct#hash #309

Open neilconway opened 11 years ago

neilconway commented 11 years ago

We spend a reasonable amount of time computing and recomputing the hash value of TupleStructs. At the expense of some memory (~4 bytes per tuple), we could memoize and cache the result of TupleStruct#hash. On a quick join benchmark (test/perf/join_bench.rb), this improves performance by about 10%.

It only works when tuples are immutable, but they probably should be anyway.