Discussion:
[erlang-patches] [PATCH] - Add NIF function enif_phash2
unknown
2013-02-07 23:58:49 UTC
Permalink
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
unknown
2013-02-08 08:34:02 UTC
Permalink
Post by unknown
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
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
unknown
2013-02-08 13:39:06 UTC
Permalink
Post by unknown
Post by unknown
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
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
unknown
2013-02-08 20:19:38 UTC
Permalink
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
Post by unknown
Post by unknown
Post by unknown
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
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
unknown
2013-02-11 09:23:38 UTC
Permalink
Post by unknown
Fredrik,
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
Post by unknown
Post by unknown
Post by unknown
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
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
unknown
2013-02-14 14:25:43 UTC
Permalink
Post by unknown
Fredrik,
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
Post by unknown
Post by unknown
Post by unknown
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
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
unknown
2013-11-12 09:44:23 UTC
Permalink
Post by unknown
Post by unknown
Fredrik,
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
Post by unknown
Post by unknown
Post by unknown
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
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
Henrik Nord
2015-02-12 09:20:10 UTC
Permalink
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
Post by unknown
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
erlang:phash2(Term, 16#100000000)
Thanks,
Paul Davis
_______________________________________________
erlang-patches mailing list
http://erlang.org/mailman/listinfo/erlang-patches
--
/Henrik Nord Erlang/OTP
Loading...