<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>c/fnv.c</filename>
    </added>
    <added>
      <filename>c/fnv.h</filename>
    </added>
    <added>
      <filename>c/fnv_drv.c</filename>
    </added>
    <added>
      <filename>c/murmur.c</filename>
    </added>
    <added>
      <filename>c/murmur.h</filename>
    </added>
    <added>
      <filename>c/murmur_drv.c</filename>
    </added>
    <added>
      <filename>elibs/fnv.erl</filename>
    </added>
    <added>
      <filename>elibs/murmur.erl</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -4,4 +4,6 @@ Authors of dynomite.
  Todd Lipcon &lt;todd@lipcon.org&gt;
  Jason Pellerin &lt;jpellerin@gmail.com&gt;
 
-The plumbing for the couch storage engine is from the couchdb project: http://incubator.apache.org/couchdb/
\ No newline at end of file
+The plumbing for the couch storage engine is from the couchdb project: http://incubator.apache.org/couchdb/
+
+MurmurHash2 is courtesy of Austin Appleby 
\ No newline at end of file</diff>
      <filename>AUTHORS</filename>
    </modified>
    <modified>
      <diff>@@ -2,10 +2,15 @@
 require 'fileutils'
 require 'rubygems'
 require 'rake'
+require 'rake/clean'
 
 ERLC_TEST_FLAGS = &quot;-pa deps/eunit/ebin -I deps/eunit/include -DTEST&quot;
 ERLC_FLAGS = &quot;+debug_info -W0 -I include -pa deps/mochiweb/ebin -I deps/mochiweb/include -pa deps/rfc4627/ebin -I deps/rfc4627/include -I gen-erl/ -o ebin&quot;
 
+CLEAN.include(&quot;ebin/*.beam&quot;)
+CLEAN.include(&quot;c/*.o&quot;)
+CLEAN.include(&quot;lib/*.so&quot;)
+
 task :default =&gt; [:build_deps, :build_c_drivers] do
   puts &quot;building #{ENV['TEST']}&quot;
   sh &quot;erlc  #{ERLC_FLAGS} #{ENV['TEST'] ? ERLC_TEST_FLAGS : ''} elibs/*.erl gen-erl/*.erl&quot;
@@ -18,15 +23,6 @@ task :default =&gt; [:build_deps, :build_c_drivers] do
   # end
 end
 
-task :clean_test do
-  sh &quot;rm -rf etest/log/*&quot;
-end
-
-task :clean =&gt; [:clean_test] do
-  sh &quot;rm -f ebin/*.beam&quot;
-  sh &quot;rm -f etest/*.beam&quot;
-end
-
 task :test_env =&gt; [:build_test_deps, :test_config] do
   puts &quot;test env&quot;
   ENV['TEST'] = 'test'
@@ -115,7 +111,7 @@ task :c_env do
   ERLDIR = `awk -F= '/ROOTDIR=/ { print $2; exit; }' #{ERL}`.chomp
   ERTSBASE = `erl -noshell -noinput -eval 'io:format (\&quot;~s\&quot;, [[ \&quot;/\&quot; ++ filename:join (lists:reverse ([ \&quot;erts-\&quot; ++ erlang:system_info (version) | tl (lists:reverse (string:tokens (code:lib_dir (), \&quot;/\&quot;))) ])) ]]).' -s erlang halt `.chomp
   ERL_INTERFACE = `ls #{ERLDIR}/lib`.split(&quot;\n&quot;).grep(/erl_interface/).last
-  CPPFLAGS = &quot;-I #{ERTSBASE}/include -I #{ERLDIR}/lib/#{ERL_INTERFACE}/include -Wall -fPIC -I./&quot;
+  CPPFLAGS = &quot;-I #{ERTSBASE}/include -I #{ERLDIR}/lib/#{ERL_INTERFACE}/include -Wall -g -O2 -fPIC -I./&quot;
   LIBEI = &quot;#{ERLDIR}/lib/#{ERL_INTERFACE}/lib/libei.a&quot;
   if `uname` =~ /Linux/
     LDFLAGS = &quot; -shared&quot;
@@ -164,9 +160,11 @@ DRIVERS = FileList['c/*_drv.c'].pathmap(&quot;%{c,lib}X.so&quot;)
 
 directory &quot;lib&quot;
 
-rule &quot;.so&quot; =&gt; '%{lib,c}X.o' do |t|
-  puts &quot;cc #{CPPFLAGS} #{LDFLAGS} -o #{t.name} #{t.source} #{LIBEI}&quot;
-  sh &quot;cc #{CPPFLAGS} #{LDFLAGS} -o #{t.name} #{t.source} #{LIBEI}&quot;
+# task &quot;lib/murmur_drv.c&quot; =&gt; [&quot;c/murmur.o&quot;]
+
+rule &quot;.so&quot; =&gt; ['%{lib,c}X.o', 'c/murmur.o', 'c/fnv.o'] do |t|
+  puts &quot;cc #{CPPFLAGS} #{LDFLAGS} -o #{t.name} #{t.prerequisites.join(' ')} #{LIBEI}&quot;
+  sh &quot;cc #{CPPFLAGS} #{LDFLAGS} -o #{t.name} #{t.prerequisites.join(' ')} #{LIBEI}&quot;
 end
 
 rule &quot;.o&quot; =&gt; &quot;.c&quot; do |t|
@@ -174,4 +172,6 @@ rule &quot;.o&quot; =&gt; &quot;.c&quot; do |t|
   sh &quot;cc #{CPPFLAGS} -c -o #{t.name} #{t.source}&quot;
 end
 
+
+
 task :build_c_drivers =&gt; [:c_env, &quot;lib&quot;] + DRIVERS
\ No newline at end of file</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -8,15 +8,17 @@ start() -&gt;
   application:load(dynomite),
   % spawn(fun() -&gt; collect_loop() end),
   crypto:start(),
+  murmur:start(),
+  fnv:start(),
   application:start(dynomite).
   
 collect_loop() -&gt;
   process_flag(trap_exit, true),
-  Filename = io_lib:format(&quot;/home/cliff/~w-dyn.dump&quot;, [lib_misc:now_int()]),
+  Filename = io_lib:format(&quot;/home/cliff/dumps/~w-dyn.dump&quot;, [lib_misc:now_int()]),
   sys_info(Filename),
   receive
     nothing -&gt; ok
-  after 15000 -&gt; collect_loop()
+  after 5000 -&gt; collect_loop()
   end.
   
 sys_info(Filename) -&gt;</diff>
      <filename>elibs/dynomite.erl</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@
 -define(OFFSET_BASIS, 2166136261).
 -define(FNV_PRIME, 16777619).
 
--export([pmap/3, hash/1, nthdelete/2, zero_split/1, nthreplace/3, rand_str/1, position/2, shuffle/1, floor/1, ceiling/1, time_to_epoch_int/1, time_to_epoch_float/1, now_int/0, now_float/0, byte_size/1, listify/1, reverse_bits/1]).
+-export([pmap/3, hash/1, fnv/1, nthdelete/2, zero_split/1, nthreplace/3, rand_str/1, position/2, shuffle/1, floor/1, ceiling/1, time_to_epoch_int/1, time_to_epoch_float/1, now_int/0, now_float/0, byte_size/1, listify/1, reverse_bits/1]).
 
 -ifdef(TEST).
 -include(&quot;etest/lib_misc_test.erl&quot;).
@@ -111,12 +111,13 @@ gather(N, Max, Ref, L) -&gt;
 	  {Ref, Ret} -&gt; gather(N-1, Max, Ref, [Ret|L])
   end.
 
+hash(Term) -&gt; fnv:hash(Term).
   
 %32 bit fnv.  magic numbers ahoy
-hash(Term) when is_binary(Term) -&gt;
+fnv(Term) when is_binary(Term) -&gt;
   fnv_int(?OFFSET_BASIS, 0, Term);
   
-hash(Term) -&gt;
+fnv(Term) -&gt;
   fnv_int(?OFFSET_BASIS, 0, term_to_binary(Term)).
   
 fnv_int(Hash, ByteOffset, Bin) when byte_size(Bin) == ByteOffset -&gt;</diff>
      <filename>elibs/lib_misc.erl</filename>
    </modified>
    <modified>
      <diff>@@ -28,4 +28,35 @@ zero_split_test() -&gt;
   ?assertEqual({&lt;&lt;&quot;&quot;&gt;&gt;, &lt;&lt;0,&quot;abcdefg&quot;&gt;&gt;}, zero_split(&lt;&lt;0, &quot;abcdefg&quot;&gt;&gt;)),
   ?assertEqual({&lt;&lt;&quot;abd&quot;&gt;&gt;, &lt;&lt;0, &quot;efg&quot;&gt;&gt;}, zero_split(&lt;&lt;&quot;abd&quot;, 0, &quot;efg&quot;&gt;&gt;)),
   ?assertEqual({&lt;&lt;&quot;abcdefg&quot;&gt;&gt;, &lt;&lt;0&gt;&gt;}, zero_split(&lt;&lt;&quot;abcdefg&quot;,0&gt;&gt;)),
-  ?assertEqual(&lt;&lt;&quot;abcdefg&quot;&gt;&gt;, zero_split(&lt;&lt;&quot;abcdefg&quot;&gt;&gt;)).
\ No newline at end of file
+  ?assertEqual(&lt;&lt;&quot;abcdefg&quot;&gt;&gt;, zero_split(&lt;&lt;&quot;abcdefg&quot;&gt;&gt;)).
+  
+  
+hash_throughput_test_() -&gt;
+  {timeout, 120, [{?LINE, fun() -&gt;
+    Keys = lists:map(fun(N) -&gt;
+        lists:duplicate(1000, random:uniform(255))
+      end, lists:seq(1,1000)),
+    FNVStart = now_float(),
+    lists:foreach(fun(Key) -&gt;
+        fnv(Key)
+      end, Keys),
+    FNVEnd = now_float(),
+    ?debugFmt(&quot;fnv took ~ps~n&quot;, [FNVEnd - FNVStart]),
+    MStart = now_float(),
+    lists:foreach(fun(Key) -&gt;
+        hash(Key)
+      end, Keys),
+    MEnd = now_float(),
+    ?debugFmt(&quot;murmur took ~ps~n&quot;, [MEnd - MStart]),
+    FNVNStart = now_float(),
+    lists:foreach(fun(Key) -&gt;
+        fnv:hash(Key)
+      end, Keys),
+    FNVNEnd = now_float(),
+    ?debugFmt(&quot;fnv native took ~ps~n&quot;, [FNVNEnd - FNVNStart])
+  end}]}.
+  
+fnv_native_compat_test() -&gt;
+  ?assertEqual(fnv(&quot;blah&quot;), fnv:hash(&quot;blah&quot;)),
+  ?assertEqual(fnv(&lt;&lt;&quot;blah&quot;&gt;&gt;), fnv:hash(&lt;&lt;&quot;blah&quot;&gt;&gt;)),
+  ?assertEqual(fnv([&lt;&lt;&quot;blah&quot;&gt;&gt;, &quot;bleg&quot;]), fnv:hash([&lt;&lt;&quot;blah&quot;&gt;&gt;, &quot;bleg&quot;])).
\ No newline at end of file</diff>
      <filename>etest/lib_misc_test.erl</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7a41a657cf66acc597409c5d604939d9d26ea0df</id>
    </parent>
  </parents>
  <author>
    <name>Cliff Moon</name>
    <email>cliff@moonpolysoft.com</email>
  </author>
  <url>http://github.com/cliffmoon/dynomite/commit/fecb101934641a358a39fdaf83b5ac47cf7b942a</url>
  <id>fecb101934641a358a39fdaf83b5ac47cf7b942a</id>
  <committed-date>2009-01-31T14:13:47-08:00</committed-date>
  <authored-date>2009-01-31T14:13:47-08:00</authored-date>
  <message>added native murmur and fnv hashing.</message>
  <tree>ce9c951834a1692c3169de70e91c0ddf617c5b74</tree>
  <committer>
    <name>Cliff Moon</name>
    <email>cliff@moonpolysoft.com</email>
  </committer>
</commit>
