owned this note changed 7 years ago
Linked with GitHub

2018q1 Homework1 (phonebook)

contributed by<asssde2002>

Reviewed by vulxj0j8j8

  • 沒有展示系統環境的相關資料
  • 缺少其他方法的研究與討論

Reviewed by potter903p

  • 麻煩將實驗結果 push 到 github 帳號中
  • 開發環境可以透過 $ lscpu 指令顯示
  • 請達到基本的作業要求!

開發環境

方法一、減少 size of entry

1.Original

Performance counter stats for './phonebook_orig' (100 runs):

          104,1681      cache-misses              #   90.149 % of all cache refs      ( +-  0.15% )
          115,5509      cache-references                                              ( +-  0.13% )
       2,6226,6399      instructions              #    1.47  insn per cycle           ( +-  0.02% )
       1,7837,1341      cycles                                                        ( +-  0.25% )

       0.058848171 seconds time elapsed                                          ( +-  0.29% )

2.減少size後

Performance counter stats for './phonebook_opt' (100 runs):

           12,3273      cache-misses              #   30.684 % of all cache refs      ( +-  0.75% )
           40,1748      cache-references                                              ( +-  0.51% )
       2,4446,0697      instructions              #    1.97  insn per cycle           ( +-  0.02% )
       1,2408,4780      cycles                                                        ( +-  0.28% )

       0.041057655 seconds time elapsed                                          ( +-  0.35% )

結論

發現程式當中只有用到 lastname ,因此把無關的剔除掉後,entry size 從 136 Bytes 減少為 40 Bytes ,cache misses 從 90% 大幅降低至 30% 。

複習

Select a repo