Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup

  • Loading branch information...
commit ff63363c783e83d7bd3a385d4921057630b6558e 1 parent 4e0fe9a
Cliff Moon authored
View
2  ebin/ef_examples.app
@@ -7,8 +7,8 @@
ef_examples_sup,
benchmark,
fnv_slow,
- fnv_terrible,
fnv_nif,
+ fnv_offset,
ef_bench
]},
{registered, []},
View
3  src/ef_bench.erl
@@ -4,10 +4,9 @@
run() ->
Bin = list_to_binary(lists:map(fun(N) -> N rem 255 end, lists:seq(0,10000000))),
- fnv_nif:init(),
R1 = benchmark:time(fun() -> fnv_nif:hash(Bin) end),
io:format("nif: ~p~n", [R1]),
R2 = benchmark:time(fun() -> fnv_slow:hash(Bin) end),
io:format("slow: ~p~n", [R2]),
- R3 = benchmark:time(fun() -> fnv_terrible:hash(Bin) end),
+ R3 = benchmark:time(fun() -> fnv_offset:hash(Bin) end),
io:format("terrible: ~p~n", [R3]).
View
3  src/fnv_terrible.erl → src/fnv_offset.erl
@@ -1,11 +1,10 @@
--module(fnv_terrible).
+-module(fnv_offset).
-export([hash/1]).
-define(OFFSET_BASIS, 2166136261).
-define(FNV_PRIME, 16777619).
-%32 bit fnv. magic numbers ahoy
hash(Term) when is_binary(Term) ->
fnv_int(?OFFSET_BASIS, 0, Term);
View
1  src/fnv_slow.erl
@@ -5,7 +5,6 @@
-define(OFFSET_BASIS, 2166136261).
-define(FNV_PRIME, 16777619).
-%32 bit fnv. magic numbers ahoy
hash(Term) when is_binary(Term) ->
fnv_int(?OFFSET_BASIS, Term);
Please sign in to comment.
Something went wrong with that request. Please try again.