[erlang-questions] erlang-questions Digest, Vol 17, Issue 41
John Haugeland
stonecypher@REDACTED
Thu Oct 9 23:53:31 CEST 2008
>
> For example, if each of your player processes has a handle to each other
>>>
>> player process, spin up a process for a given match instead, and give the
>> player processes a hook to that and nothing else.
>>
>
> How does this work? Can you elaborate a bit?
Every mailing list needs ascii art!
If it used to be
A---B
/|\ /|\
C-+-*-+-D (plus connections I can't draw
\|/ \|/ from A-D, B-C, D-E, C-F)
E---F
Then change it to
Z
/|\
// \\
/ | | \
/\ | | /\
A B C D E F
Instead of (6*5)=30 pids, you're now tracking (6*1)+6=12 pids. The savings
goes up the larger the games get, because in the old fully connected network
you need N*(N-1) connections per game, whereas in the new network you need
2N connections per game, and exponential vs linear growth, and rada rada
rada.
>
> Bang: 7/8 or so savings
>> on PID space, and probably a significant speed increase despite the extra
>> messaging, since you're going to get so many more correct branch
>> predictions
>> and cache wins.
>>
>
> And how do you measure cache wins and branch predictions with Erlang?
Ancient wisdom. When you've been programming 20+ years, you can smell
what's going to work and what isn't. And, I know, for someone who says
"intuition is worthless, profile it" as much as I do, that's kind of
hypocritical in the way that the ocean is kind of wet, but I haven't really
taken the time to learn Erlang's profiling situation yet, so it's the best
I've got.
But, I mean, when you drop the size of a block of data by 80-85%, you're
just going to keep a lot more of it in cache, and when the data has stronger
locality, it's more likely to get a good branch prediction. That's just the
nature of modern branch prediction algorithms. There's a fascinating (if
somewhat poorly written) discussion of these issues in the original Judy
Tree papers by that guy from Hewlett Packard.
- John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081009/847ec076/attachment.htm>
More information about the erlang-questions
mailing list