快乐双彩9码复式多少钱:Content-to-markup ratio bookmarklet

March 5th, 2009. Tagged: Ajax, bookmarklets, JavaScript, performance, SEO

When you care about performance, or SEO (or just doing a good job as web dev) an interesting data point is the ratio of page content vs. the markup used to present this content. Or... how much crap we put in HTML in order to present what the users want to see - the content.

So I played tonight with a bookmarklet to provide this piece of stats.

Install

Right-click, add to favourites/bookmarks. Or simply click to see the ratio of this page.

content/markup

How it works

Since the scripts on the page may modify the content and markup, the bookmarklet makes an Ajax request to get a fresh copy of the page from the server. Then it runs a few regular expressions ("borrowed" from prototype.js) to strip all tags and the scripts/styles content. The first metric it provides is the size of the stripped content divided by the size of the original markup.

Then the bookmarklet tries to be more fair and count the alt, title and value attributes as content, including the size of attribute names themselves. And this is the second, "fair", metric. The content attributes are inspected using DOM methods, not regexp, so they can be affected by any javascript that has modified the page. Oh well, life's not fair.

Code

The bookmarklet code is served from here. The code is also on github.

Results

Here are some random results of running the bookmarklet on different sites.

//www.cnn.com:
Total size: 92004 bytes
Content size: 11475 bytes
Content-to-markup ratio: 0.12
Fair ratio * : 0.16

//www.sitepoint.com
Total size: 65989 bytes
Content size: 16199 bytes
Content-to-markup ratio: 0.25
Fair ratio * : 0.60

Article on //en.wikipedia.org:
Total size: 21648 bytes
Content size: 3315 bytes
Content-to-markup ratio: 0.15
Fair ratio * : 0.35

//www.v3w2.cn
Total size: 31899 bytes
Content size: 7933 bytes
Content-to-markup ratio: 0.25
Fair ratio * : 0.48

//www.google.com SERP
Total size: 29963 bytes
Content size: 3351 bytes
Content-to-markup ratio: 0.11
Fair ratio * : 0.14

Tell your friends about this post: Facebook, Twitter, Google+

Sorry, comments disabled and hidden due to excessive spam.

Meanwhile, hit me up on twitter @stoyanstefanov


  • 邀你参赛世界杯《热血足球》正版手游iOS公测开启 2019-06-22
  • 【理上网来喜迎十九大】推动中国经济乘风破浪行稳致远 2019-06-22
  • 向“份子钱”开刀 广州的士再改革 2019-06-18
  • 不是从天上掉下来的,难道是从“文革”中走来的吗? 2019-06-12
  • 把黄土高坡变绿的造林人 2019-06-12
  • 缅甸国务资政昂山素季会见魏凤和 2019-06-06
  • 2017年第96届全国糖酒会在成都圆满落幕 2019-06-06
  • 杂志榜三甲大洗牌,“国家人文历史”夺榜首今日头条媒体榜 2019-05-25
  • 76人参加高山滑雪跨界跨项选材测试 或进冬奥备战梯队 2019-05-18
  • 不是特效!上港队长一脚踢中海鸥 这脚法简直坑爹 2019-05-08
  • 新疆坚决打好污染防治攻坚战 2019-05-07
  • 高考在即,晋中市招生考试管理中心提醒广大考生及家长要把握好高考“四个趋势” 2019-04-25
  • 运城市在长三角招商引资149.9亿元 2019-04-08
  • 济南五胞胎雪虎宝宝亮相 四雌一雄萌态十足 2019-04-08
  • 去产能迎年中考 煤炭、钢铁企业债务问题依然存在 2019-04-07
  • 彩票500万图表走势图 陕西十一选五今天的全部开奖结果 大运网彩票官网 福建36选7复式票规则 360浏览新浪彩票网 中彩票500万交多少税 赛马会高级二肖中特码 体彩大乐透预测爱彩网 足球彩票14场胜负彩预测 福彩排列七综合走势图 3d试机号对应码金码 彩票开奖机器gif 欢乐升级四副牌 上海天天彩选四历史记录 西安彩票投注站怎么开