[PATCH] - Add NIF function enif_phash2

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] - Add NIF function enif_phash2

Paul Davis
git fetch git://github.com/davisp/otp.git enif_phash2

https://github.com/davisp/otp/compare/maint...enif_phash2
https://github.com/davisp/otp/compare/maint...enif_phash2.patch

This patch exposes the phash2 function to NIFs. It is exactly equivalent to:

    erlang:phash2(Term, 16#100000000)

Thanks,
Paul Davis

Reply | Threaded
Open this post in threaded view
|

[PATCH] - Add NIF function enif_phash2

Fredrik
On 02/08/2013 12:58 AM, Paul Davis wrote:

> git fetch git://github.com/davisp/otp.git enif_phash2
>
> https://github.com/davisp/otp/compare/maint...enif_phash2
> https://github.com/davisp/otp/compare/maint...enif_phash2.patch
>
> This patch exposes the phash2 function to NIFs. It is exactly equivalent to:
>
>      erlang:phash2(Term, 16#100000000)
>
> Thanks,
> Paul Davis
> _______________________________________________
> erlang-patches mailing list
> erlang-patches
> http://erlang.org/mailman/listinfo/erlang-patches
Please rebase this patch upon the current 'master' branch.
Thanks,

--

BR Fredrik Gustafsson
Erlang OTP Team


Reply | Threaded
Open this post in threaded view
|

[PATCH] - Add NIF function enif_phash2

Sverker Eriksson-3
Fredrik wrote:

> On 02/08/2013 12:58 AM, Paul Davis wrote:
>> git fetch git://github.com/davisp/otp.git enif_phash2
>>
>> https://github.com/davisp/otp/compare/maint...enif_phash2
>> https://github.com/davisp/otp/compare/maint...enif_phash2.patch
>>
>> This patch exposes the phash2 function to NIFs. It is exactly
>> equivalent to:
>>
>> erlang:phash2(Term, 16#100000000)
>>
>> Thanks,
>> Paul Davis
>> _______________________________________________
>> erlang-patches mailing list
>> erlang-patches
>> http://erlang.org/mailman/listinfo/erlang-patches
> Please rebase this patch upon the current 'master' branch.
> Thanks,
>
Also read the comments in erl_nif_api_funcs.h of how to add new functions.
You do not have to increase ERL_NIF_MINOR_VERSION as I've already done
that for R16B.

I guess you have a real use case for enif_phash2 and why erlang:phash2
is not enough.

/Sverker

Reply | Threaded
Open this post in threaded view
|

[PATCH] - Add NIF function enif_phash2

Paul Davis
Fredrik,

Rebased against master:

git fetch git://github.com/davisp/otp.git enif_phash2

https://github.com/davisp/otp/compare/master...enif_phash2
https://github.com/davisp/otp/compare/master...enif_phash2.patch

Sverker,

I've updated the function ordering as per the comment in
erl_nif_api_funcs.h. For use case, I'm implementing a couple data
structures that use hash tables to speed up some hot loops. I can get
away for awhile using erlang:phash2/2 in Erlang and passing that value
into the NIF but this breaks down when I don't know a priori which
terms (or subterms) I may need to hash in the NIF.

A similar example would be trying to reimplement ets without this.
Either I'd have to store enough information in the Erlang term
representing the table to be able to know which elements of the tuple
to hash or I'd have to ask the table what to hash before passing the
term off to the NIF. There are definitely work arounds to not having
access to phash2 but they aren't pretty.

Thanks,
Paul Davis

On Fri, Feb 8, 2013 at 7:39 AM, Sverker Eriksson
<sverker.eriksson> wrote:

> Fredrik wrote:
>>
>> On 02/08/2013 12:58 AM, Paul Davis wrote:
>>>
>>> git fetch git://github.com/davisp/otp.git enif_phash2
>>>
>>> https://github.com/davisp/otp/compare/maint...enif_phash2
>>> https://github.com/davisp/otp/compare/maint...enif_phash2.patch
>>>
>>> This patch exposes the phash2 function to NIFs. It is exactly equivalent
>>> to:
>>>
>>> erlang:phash2(Term, 16#100000000)
>>>
>>> Thanks,
>>> Paul Davis
>>> _______________________________________________
>>> erlang-patches mailing list
>>> erlang-patches
>>> http://erlang.org/mailman/listinfo/erlang-patches
>>
>> Please rebase this patch upon the current 'master' branch.
>> Thanks,
>>
> Also read the comments in erl_nif_api_funcs.h of how to add new functions.
> You do not have to increase ERL_NIF_MINOR_VERSION as I've already done that
> for R16B.
>
> I guess you have a real use case for enif_phash2 and why erlang:phash2 is
> not enough.
>
> /Sverker

Reply | Threaded
Open this post in threaded view
|

[PATCH] - Add NIF function enif_phash2

Fredrik
On 02/08/2013 09:19 PM, Paul Davis wrote:

> Fredrik,
>
> Rebased against master:
>
> git fetch git://github.com/davisp/otp.git enif_phash2
>
> https://github.com/davisp/otp/compare/master...enif_phash2
> https://github.com/davisp/otp/compare/master...enif_phash2.patch
>
> Sverker,
>
> I've updated the function ordering as per the comment in
> erl_nif_api_funcs.h. For use case, I'm implementing a couple data
> structures that use hash tables to speed up some hot loops. I can get
> away for awhile using erlang:phash2/2 in Erlang and passing that value
> into the NIF but this breaks down when I don't know a priori which
> terms (or subterms) I may need to hash in the NIF.
>
> A similar example would be trying to reimplement ets without this.
> Either I'd have to store enough information in the Erlang term
> representing the table to be able to know which elements of the tuple
> to hash or I'd have to ask the table what to hash before passing the
> term off to the NIF. There are definitely work arounds to not having
> access to phash2 but they aren't pretty.
>
> Thanks,
> Paul Davis
>
> On Fri, Feb 8, 2013 at 7:39 AM, Sverker Eriksson
> <sverker.eriksson>  wrote:
>> Fredrik wrote:
>>> On 02/08/2013 12:58 AM, Paul Davis wrote:
>>>> git fetch git://github.com/davisp/otp.git enif_phash2
>>>>
>>>> https://github.com/davisp/otp/compare/maint...enif_phash2
>>>> https://github.com/davisp/otp/compare/maint...enif_phash2.patch
>>>>
>>>> This patch exposes the phash2 function to NIFs. It is exactly equivalent
>>>> to:
>>>>
>>>> erlang:phash2(Term, 16#100000000)
>>>>
>>>> Thanks,
>>>> Paul Davis
>>>> _______________________________________________
>>>> erlang-patches mailing list
>>>> erlang-patches
>>>> http://erlang.org/mailman/listinfo/erlang-patches
>>> Please rebase this patch upon the current 'master' branch.
>>> Thanks,
>>>
>> Also read the comments in erl_nif_api_funcs.h of how to add new functions.
>> You do not have to increase ERL_NIF_MINOR_VERSION as I've already done that
>> for R16B.
>>
>> I guess you have a real use case for enif_phash2 and why erlang:phash2 is
>> not enough.
>>
>> /Sverker
Re-fetched. Currently cooking in the 'master-pu' branch.
Thanks,

--

BR Fredrik Gustafsson
Erlang OTP Team


Reply | Threaded
Open this post in threaded view
|

[PATCH] - Add NIF function enif_phash2

Fredrik
In reply to this post by Paul Davis
On 02/08/2013 09:19 PM, Paul Davis wrote:

> Fredrik,
>
> Rebased against master:
>
> git fetch git://github.com/davisp/otp.git enif_phash2
>
> https://github.com/davisp/otp/compare/master...enif_phash2
> https://github.com/davisp/otp/compare/master...enif_phash2.patch
>
> Sverker,
>
> I've updated the function ordering as per the comment in
> erl_nif_api_funcs.h. For use case, I'm implementing a couple data
> structures that use hash tables to speed up some hot loops. I can get
> away for awhile using erlang:phash2/2 in Erlang and passing that value
> into the NIF but this breaks down when I don't know a priori which
> terms (or subterms) I may need to hash in the NIF.
>
> A similar example would be trying to reimplement ets without this.
> Either I'd have to store enough information in the Erlang term
> representing the table to be able to know which elements of the tuple
> to hash or I'd have to ask the table what to hash before passing the
> term off to the NIF. There are definitely work arounds to not having
> access to phash2 but they aren't pretty.
>
> Thanks,
> Paul Davis
>
> On Fri, Feb 8, 2013 at 7:39 AM, Sverker Eriksson
> <sverker.eriksson>  wrote:
>> Fredrik wrote:
>>> On 02/08/2013 12:58 AM, Paul Davis wrote:
>>>> git fetch git://github.com/davisp/otp.git enif_phash2
>>>>
>>>> https://github.com/davisp/otp/compare/maint...enif_phash2
>>>> https://github.com/davisp/otp/compare/maint...enif_phash2.patch
>>>>
>>>> This patch exposes the phash2 function to NIFs. It is exactly equivalent
>>>> to:
>>>>
>>>> erlang:phash2(Term, 16#100000000)
>>>>
>>>> Thanks,
>>>> Paul Davis
>>>> _______________________________________________
>>>> erlang-patches mailing list
>>>> erlang-patches
>>>> http://erlang.org/mailman/listinfo/erlang-patches
>>> Please rebase this patch upon the current 'master' branch.
>>> Thanks,
>>>
>> Also read the comments in erl_nif_api_funcs.h of how to add new functions.
>> You do not have to increase ERL_NIF_MINOR_VERSION as I've already done that
>> for R16B.
>>
>> I guess you have a real use case for enif_phash2 and why erlang:phash2 is
>> not enough.
>>
>> /Sverker
Hello could you rebase this upon the current 'master' branch on github
Thanks,

--

BR Fredrik Gustafsson
Erlang OTP Team


Reply | Threaded
Open this post in threaded view
|

[PATCH] - Add NIF function enif_phash2

Henrik Nord-3

On 2013-02-14 15:25, Fredrik wrote:

> On 02/08/2013 09:19 PM, Paul Davis wrote:
>> Fredrik,
>>
>> Rebased against master:
>>
>> git fetch git://github.com/davisp/otp.git enif_phash2
>>
>> https://github.com/davisp/otp/compare/master...enif_phash2
>> https://github.com/davisp/otp/compare/master...enif_phash2.patch
>>
>> Sverker,
>>
>> I've updated the function ordering as per the comment in
>> erl_nif_api_funcs.h. For use case, I'm implementing a couple data
>> structures that use hash tables to speed up some hot loops. I can get
>> away for awhile using erlang:phash2/2 in Erlang and passing that value
>> into the NIF but this breaks down when I don't know a priori which
>> terms (or subterms) I may need to hash in the NIF.
>>
>> A similar example would be trying to reimplement ets without this.
>> Either I'd have to store enough information in the Erlang term
>> representing the table to be able to know which elements of the tuple
>> to hash or I'd have to ask the table what to hash before passing the
>> term off to the NIF. There are definitely work arounds to not having
>> access to phash2 but they aren't pretty.
>>
>> Thanks,
>> Paul Davis
>>
>> On Fri, Feb 8, 2013 at 7:39 AM, Sverker Eriksson
>> <sverker.eriksson>  wrote:
>>> Fredrik wrote:
>>>> On 02/08/2013 12:58 AM, Paul Davis wrote:
>>>>> git fetch git://github.com/davisp/otp.git enif_phash2
>>>>>
>>>>> https://github.com/davisp/otp/compare/maint...enif_phash2
>>>>> https://github.com/davisp/otp/compare/maint...enif_phash2.patch
>>>>>
>>>>> This patch exposes the phash2 function to NIFs. It is exactly
>>>>> equivalent
>>>>> to:
>>>>>
>>>>> erlang:phash2(Term, 16#100000000)
>>>>>
>>>>> Thanks,
>>>>> Paul Davis
>>>>> _______________________________________________
>>>>> erlang-patches mailing list
>>>>> erlang-patches
>>>>> http://erlang.org/mailman/listinfo/erlang-patches
>>>> Please rebase this patch upon the current 'master' branch.
>>>> Thanks,
>>>>
>>> Also read the comments in erl_nif_api_funcs.h of how to add new
>>> functions.
>>> You do not have to increase ERL_NIF_MINOR_VERSION as I've already
>>> done that
>>> for R16B.
>>>
>>> I guess you have a real use case for enif_phash2 and why
>>> erlang:phash2 is
>>> not enough.
>>>
>>> /Sverker

> Hello could you rebase this upon the current 'master' branch on github
> Thanks,

Ping!



--
/Henrik Nord Erlang/OTP


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] - Add NIF function enif_phash2

Henrik Nord-2
In reply to this post by Paul Davis
Hello!

This patch has now seen 2 years of inactivity.

If you are willing to, please re-base upon current master and open a
Pull request towards Erlang/otp on github.

Thank you

On 2013-02-08 00:58, Paul Davis wrote:

> git fetch git://github.com/davisp/otp.git enif_phash2
>
> https://github.com/davisp/otp/compare/maint...enif_phash2
> https://github.com/davisp/otp/compare/maint...enif_phash2.patch
>
> This patch exposes the phash2 function to NIFs. It is exactly equivalent to:
>
>      erlang:phash2(Term, 16#100000000)
>
> Thanks,
> Paul Davis
> _______________________________________________
> erlang-patches mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-patches

--
/Henrik Nord Erlang/OTP

_______________________________________________
erlang-patches mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-patches