| Author |
Message |
|
| Guest |
Posted: Wed Mar 31, 2010 8:00 am |
|
|
|
Guest
|
Hello,
Since I've been using Erlang, I've needed a function shuffle lists alot. Now
I was wondering if there could be a C implementation of this method in maybe
the lists module. Using this in raw erlang is much slower, and so I was
going to use the erl_nif interface along with some other lists functions to
make this faster. I want to know what you guys would think about
implementing this into the lists module.
William van Doorn
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Mar 31, 2010 8:00 am |
|
|
|
Guest
|
Hello,
Since I've been using Erlang, I've needed a function shuffle lists alot. Now
I was wondering if there could be a C implementation of this method in maybe
the lists module. Using this in raw erlang is much slower, and so I was
going to use the erl_nif interface along with some other lists functions to
make this faster. I want to know what you guys would think about
implementing this into the lists module.
William van Doorn
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Mar 31, 2010 8:24 am |
|
|
|
Guest
|
On Wed, Mar 31, 2010 at 10:00 AM, William v Doorn
<williamvdoorn@gmail.com> wrote:
> Since I've been using Erlang, I've needed a function shuffle lists alot. Now
> I was wondering if there could be a C implementation of this method in maybe
> the lists module. Using this in raw erlang is much slower, and so I was
> going to use the erl_nif interface along with some other lists functions to
> make this faster. I want to know what you guys would think about
> implementing this into the lists module.
We are generally wary about including new functions into the lists modules.
Only functions that would be useful for many users will be considered for
inclusion.
Another thing is that we don't want the lists module to start loading NIFs
(we will probably never have any NIFs in the kernel and stdlib applications).
If a function deserves to be in the lists module and if it should be
implemented in C, we will implement it as an ordinary BIF.
What exactly does your shuffle function do?
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Mar 31, 2010 8:24 am |
|
|
|
Guest
|
On Wed, Mar 31, 2010 at 10:00 AM, William v Doorn
<williamvdoorn@gmail.com> wrote:
> Since I've been using Erlang, I've needed a function shuffle lists alot. Now
> I was wondering if there could be a C implementation of this method in maybe
> the lists module. Using this in raw erlang is much slower, and so I was
> going to use the erl_nif interface along with some other lists functions to
> make this faster. I want to know what you guys would think about
> implementing this into the lists module.
We are generally wary about including new functions into the lists modules.
Only functions that would be useful for many users will be considered for
inclusion.
Another thing is that we don't want the lists module to start loading NIFs
(we will probably never have any NIFs in the kernel and stdlib applications).
If a function deserves to be in the lists module and if it should be
implemented in C, we will implement it as an ordinary BIF.
What exactly does your shuffle function do?
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Mar 31, 2010 2:44 pm |
|
|
|
Guest
|
(Please keep the discussion on the mailing list. I have
added back a CC to the list.)
2010/3/31 William v Doorn <williamvdoorn@gmail.com>:
> Hello,
>
> It's been implemented in the "standard" libaries of like every popular
> langauge. It basically shuffles the list. Here are two examples of
> implemenations:
>
> - Python: http://docs.python.org/library/random.html (Scroll down a bit)
> - Java:
> http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html#shuffle(java.util.List)
>
I think that we might consider adding a shuffle() function to the
'random' module.
Could you show us your Erlang implementation shuffle() function that you
considered too slow. Perhaps it can be optimized to be fast enough. We
will need a reference implementation anyway, because we will not add
any new BIFs before benchmarking them to see whether the performance
improvement is significant enough.
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Mar 31, 2010 2:44 pm |
|
|
|
Guest
|
(Please keep the discussion on the mailing list. I have
added back a CC to the list.)
2010/3/31 William v Doorn <williamvdoorn@gmail.com>:
> Hello,
>
> It's been implemented in the "standard" libaries of like every popular
> langauge. It basically shuffles the list. Here are two examples of
> implemenations:
>
> - Python: http://docs.python.org/library/random.html (Scroll down a bit)
> - Java:
> http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html#shuffle(java.util.List)
>
I think that we might consider adding a shuffle() function to the
'random' module.
Could you show us your Erlang implementation shuffle() function that you
considered too slow. Perhaps it can be optimized to be fast enough. We
will need a reference implementation anyway, because we will not add
any new BIFs before benchmarking them to see whether the performance
improvement is significant enough.
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Mar 31, 2010 2:58 pm |
|
|
|
Guest
|
2010/3/31 Björn Gustavsson <bgustavsson@gmail.com>:
> (Please keep the discussion on the mailing list. I have
> added back a CC to the list.)
>
> 2010/3/31 William v Doorn <williamvdoorn@gmail.com>:
>> Hello,
>>
>> It's been implemented in the "standard" libaries of like every popular
>> langauge. It basically shuffles the list. Here are two examples of
>> implemenations:
>>
>> - Python: http://docs.python.org/library/random.html (Scroll down a bit)
>> - Java:
>> http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html#shuffle(java.util.List)
>>
>
> I think that we might consider adding a shuffle() function to the
> 'random' module.
>
> Could you show us your Erlang implementation shuffle() function that you
> considered too slow. Perhaps it can be optimized to be fast enough. We
> will need a reference implementation anyway, because we will not add
> any new BIFs before benchmarking them to see whether the performance
> improvement is significant enough.
It would be nice if the shuffle function provided a function and state
parameter for entropy so that you could decide whether to use
something deterministic (e.g. the functional API to random) or a
different source (e.g. the crypto module).
A shuffle function is something we'd find useful, but we've gotten by
without actually implementing a full and correct shuffle
implementation.
-bob
________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Wed Mar 31, 2010 2:58 pm |
|
|
|
Guest
|
2010/3/31 Björn Gustavsson <bgustavsson@gmail.com>:
> (Please keep the discussion on the mailing list. I have
> added back a CC to the list.)
>
> 2010/3/31 William v Doorn <williamvdoorn@gmail.com>:
>> Hello,
>>
>> It's been implemented in the "standard" libaries of like every popular
>> langauge. It basically shuffles the list. Here are two examples of
>> implemenations:
>>
>> - Python: http://docs.python.org/library/random.html (Scroll down a bit)
>> - Java:
>> http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html#shuffle(java.util.List)
>>
>
> I think that we might consider adding a shuffle() function to the
> 'random' module.
>
> Could you show us your Erlang implementation shuffle() function that you
> considered too slow. Perhaps it can be optimized to be fast enough. We
> will need a reference implementation anyway, because we will not add
> any new BIFs before benchmarking them to see whether the performance
> improvement is significant enough.
It would be nice if the shuffle function provided a function and state
parameter for entropy so that you could decide whether to use
something deterministic (e.g. the functional API to random) or a
different source (e.g. the crypto module).
A shuffle function is something we'd find useful, but we've gotten by
without actually implementing a full and correct shuffle
implementation.
-bob
________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org
Post received from mailinglist |
|
|
| Back to top |
|
|
|