파일:Hash table average insertion time.png

testwiki
둘러보기로 이동 검색으로 이동
    원본 파일 (954 × 620 픽셀, 파일 크기: 5 KB, MIME 종류: image/png)

    이 파일은 위키미디어 공용에 있으며, 다른 프로젝트에서 사용하고 있을 가능성이 있습니다. 해당 파일에 대한 설명이 아래에 나와 있습니다.

    이 그림 파일은 벡터 SVG 형식으로 다시 만들어야 합니다. SVG의 장점에 대해서는 여기(영어)를 참고해 주십시오. 만약 이 그림의 SVG 버전이 이미 존재한다면 이 틀을 {{vector version available|새 파일 이름}}으로 대체해 주십시오.

    파일 설명

    설명

    Shows the average number of cache misses expected when inserting into a hash table with various collision resolution mechanisms; on modern machines, this is a good estimate of actual clock time required. This seems to confirm the common heuristic that performance begins to degrade at about 80% table density. Created in Mathematica, Illustrator, and Photoshop.

    It is based on a simulated model of a hash table where the hash function chooses indexes for each insertion uniformly at random. The parameters of the model were:

    • A table size of 1,000 elements.
    • An L1 cache line size of 16 words, as on the Pentium 4. L2 cache effects are not accounted for.

    For modern CPUs, which have many kilobytes of L1 cache, same logic applies for tables far bigger than size of the cache.

    You may be curious what happens in the case where no cache exists. In other words, how does the number of probes (number of reads, number of comparisons) rise as the table fills? The curve is similar in shape to the one above, but shifted left: it requires an average of 24 probes for an 80% full table, and you have to go down to a 50% full table for only 3 probes to be required on average. This suggests that in the absence of a cache, ideally your hash table should be about twice as large for probing as for chaining.
    출처 Author's Own Work.
     이 다이어그램 Mathematica(으)로 제작되었습니다.
    저자 Derrick Coetzee (User:Dcoetzee)
    저작권
    (이 파일을 인용하기)
    Public domain 나는 이 작품의 저작권자로서, 이 작품을 퍼블릭 도메인으로 모두에게 공개합니다. 이 공개 선언은 전 세계적으로 유효합니다.
    만약 저작권의 포기가 법률적으로 가능하지 않은 경우,
    나는 이 작품을 법적으로 허용되는 한도 내에서 누구나 자유롭게 어떤 목적으로도 제한없이 사용할 수 있도록 허용합니다.

    Mathematica Coding

    Because the linear probing values varied widely according to the random choices used to fill the table, I took the average value over 25 runs. The (rather inefficient) Mathematica code used to generate the table follows:

    <<Statistics`DescriptiveStatistics`;
    
    f[tablesize_,points_,cachewords_]:=
      Module[{i,r,j,compares1,compares2,k,slots1,slots2},
        slots1 = Table[0,{i,1,tablesize}];
        slots2 = Table[0,{i,1,tablesize}];
        Table[
          For[i=0,i<Floor[Length[slots1]/(points+1)],i++,
            r=Random[Integer,{1,Length[slots1]}];
            slots1[[r]]++];
          For[i=0,i<Length[slots1]/(points+1),i++,
            r=Random[Integer,{1,Length[slots2]}];
            For[j=r,slots2[[j]]>0,j=If[j\[Equal]Length[slots2],1,j+1]];
            slots2[[j]]++];
          compares2=0;
          For[i=1,i<=Length[slots2],i++,
            For[j=i,slots2[[j]]>0,j=If[j\[Equal]Length[slots2],1,j+1]];
            compares2+=
              Ceiling[If[j\[GreaterEqual]i,j-i,j+Length[slots2]-i]/cachewords]];
          {N[Apply[Plus,slots1]/Length[slots1]]+2,
            N[compares2/Length[slots2]]+1},{k,1,points}]];
    
    t=Table[f[1000,49,16],{i,1,25}];
    Export["Hash_table_average_insertion_time.eps",
      Show[Map[ListPlot[#,PlotJoined\[Rule]True,Frame\[Rule]True,
              FormatType\[Rule]TraditionalForm,
              FrameLabel\[Rule]{"Density of table",
                  "Average cache misses per insertion"},Axes\[Rule]False]&,
          Table[{i/50,Mean[Table[t[[k,i,j]],{k,1,Length[t]}]]},{j,1,2},{i,1,
              Length[t[[1]]]}]]]]
    

    설명

    이 파일이 나타내는 바에 대한 한 줄 설명을 추가합니다

    이 파일에 묘사된 항목

    다음을 묘사함

    4,743 바이트

    620 화소

    954 화소

    ff51d63ced85aa4254d68028abcd6015766753fc

    파일 역사

    날짜/시간 링크를 클릭하면 해당 시간의 파일을 볼 수 있습니다.

    날짜/시간섬네일크기사용자설명
    현재2011년 2월 26일 (토) 00:522011년 2월 26일 (토) 00:52 판의 섬네일954 × 620 (5 KB)wikimediacommons>Perheliontest PNGOUT plugin

    이 파일을 사용하는 문서가 없습니다.