2013年8月28日 星期三

[NOTE] HTTP 2.0

The primary goals for HTTP 2.0 are to reduce latency by enabling full request and response multiplexing, minimize protocol overhead via efficient compression of HTTP header fields, and add support for request prioritization and server push.


  • Request/Response multiplexing
    • Each session can have many streams, each stream can transfer many messages in both direction. Each message is contained by many frames. Frame is the base unit.
    • one connection per origin
      • avoid "Slow-Start" on TCP
      • better header compression
        • keep track key-value header table on server/client side

    •  
  • Server push
    • server can create stream to client as well
  • Header compression
    • header tables with key/value and maintain on server/client side
    •  so no need to send the same header if it match previous request
  • Flow control on each stream
Reference:
High Performance Browser Networking CH12

2013年8月12日 星期一

[Note] Why mobile web app are slow

Why mobile web apps are slow

這篇文章提到一些值得後續繼續觀察的地方, 記錄一下

  • JS 本身大概比 C/C++慢五倍
  • ARM 比x86 慢10倍, 所以在arm上面的mobile device上面跑js, 會比desktop上面還要慢50倍
  • 過去幾年JS的效率其實沒有多大提升, 主要可能都是硬體上效能的增進
  • GC (garbage collection) 對於效率上破壞很大, 尤其在記憶體限制的環境下, 下降的幅度可能是指數
  • iOS 上面, 單純的一張image都有可能會buffer多份
  • ARM架構上面使用POP (package on package), 這部分會影響ARM之後能夠使用更大的記憶體, 可能更困難 (相對於x86)
  • asm.js 或許是個解決方式, 但是或許chrome上面的NaCL,也是另一個方式, 畢竟asm.js 已經不算是寫js了
 不過mobile上面最佔資源的可能還試圖片或是影片, 這些部分的處理就算都用native code, 還是會因為記憶體上的限制, 所以我覺得如果ARM 架構, 能夠支援夠多的記憶體, 那JS慢也就比較無關緊要

[Font] Study note

建議把 FreeType tutorial 上面的文章看完,

下面的圖是從tutorial擷取, 在設定一些字形相關設定,可以了解關於字型的metrics:





除了glyph 本身的bitmap,有時某些字跟前文也有關係,像是當A後面接U的時候, 它們可以減少字距 (kerning), 所以glyph有些也會另外帶kerning tabl,來記錄前後文該有的間距