Comments (3)
I'm fine with doing a pre-process step via :erlang.term_to_binary/1
if that actually solves the problem, otherwise I suppose we will need a new hash function
from libring.
That should be ok as :erlang.term_to_binary
is pretty fast right? Here's some testing I did
iex(1)> :erlang.phash2(:foo)
27999
iex(2)> :erlang.phash2(:erlang.term_to_binary(:foo))
86811783
iex(3)> :erlang.phash2(:erlang.term_to_binary(:fooaaaa))
43291300
iex(4)> :erlang.phash2(:erlang.term_to_binary(:ffgfgff))
30215940
iex(5)> :erlang.phash2(:erlang.term_to_binary(:a))
64216263
iex(6)> :erlang.phash2(:erlang.term_to_binary(:aaaaaa))
86861957
iex(7)> :erlang.phash2(:erlang.term_to_binary(:b))
14428281
iex(8)> :erlang.phash2(:erlang.term_to_binary(:b), trunc(:math.pow(2,32)-1))
3235653753
iex(9)> :erlang.phash2(:foo, trunc(:math.pow(2,32)-1))
27999
iex(10)> :erlang.phash2(:erlang.term_to_binary(:foo), trunc(:math.pow(2,32)-1))
355247239
which is a lot closer to expected behavior.
from libring.
Is this why elixir HEAD is currently generating one test failure?
- test ensure function clauses are ordered (ModuleTest)
test/elixir/module_test.exs:289
Assertion with == failed
code: assert :erlang.phash2(atoms) == 61635213
left: 60755908
right: 61635213
stacktrace:
test/elixir/module_test.exs:297: (test)
from libring.
Related Issues (14)
- Invalid new state in handle_info
- Top-level Module Named Hashring conflicts with other libraries HOT 10
- Missing :logger dependency
- Tests cannot be run HOT 1
- Don't rename process (suggestion)
- `:simple_one_for_one` strategy deprecation warning in Elixir 1.10 HOT 1
- issue adding pids with the same number in different nodes HOT 1
- Using the GenServer for reads is inefficient switch to ETS instead HOT 1
- Local node never returned in key lookup
- README specifies libring version that doesn't exist in hex HOT 1
- HashRing.Managed.new doesn't work as expected HOT 1
- It would be useful to have a method that just returns the nodes HOT 1
- HashRing.add_node error - gb_trees.insert_1/4 {:key_exists} HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libring.