R.A. Epigonos et al.

[perl] 連想配列の実装

連想配列を良く使うものとして、Perl自体のもつアルゴリズムに改良があるのは嬉しいこと。

下の例だと、ハッシュの計算値は0xe9806307。

$ perl -MDevel::Peek -e 'Dump({ key =%gt; "value" })'
SV = RV(0x8e3c704) at 0x8e3c6f8
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0x8e3c818
  SV = PVHV(0x8e419b0) at 0x8e3c818
    REFCNT = 1
    FLAGS = (SHAREKEYS)
    ARRAY = 0x8e5a608  (0:7, 1:1)
    hash quality = 100.0%
    KEYS = 1
    FILL = 1
    MAX = 7
    RITER = -1
    EITER = 0x0
    Elt "key" HASH = 0xe9806307
    SV = PV(0x8e3a6d8) at 0x8e3c998
      REFCNT = 1
      FLAGS = (POK,pPOK)
      PV = 0x8e51b38 "value"\0
      CUR = 5
      LEN = 8

これを使いたければ Inline::C を使えばいいということが書いてある。

リファレンス

  1. 404 Blog Not Found:Algorithm - 連想配列の実装としてのハッシュはオワコン?
  2. perlguts perl_hash - Google 検索
  3. perlguts - Perl API の紹介 【perldoc.jp】
  4. Perlの連想配列に使うハッシュ関数 - 日々量産
  5. call perl hash function?
  6. Inline::C - Google 検索
  7. "Inline::C" "perl_hash" - Google 検索
  8. A Hash Function for Hash Table Lookup
  9. comp.lang.perl.misc: Re: accessing perl's internal hashing algorithm
  10. Devel::PPPort - search.cpan.org

ソーシャルブックマーク

  1. はてなブックマーク
  2. Google Bookmarks
  3. del.icio.us

ChangeLog

  1. Posted: 2010-03-24T22:15:48+09:00
  2. Modified: 2010-03-24T22:15:48+09:00
  3. Generated: 2023-08-27T23:09:11+09:00