当前位置: 动力学知识库 > 问答 > 编程问答 >

performance - Unfamiliar with waterfall timelines, not sure whether I need to fix font loading, map

问题描述:

I have the bootstrap companion font Glyphicon-Halflings-Regular and also a googleapis font Cinzen in my site. I have reduced Cinzen to 1.8k with the &text parameter (awesome!). I don't know how to shrink Halflings.

Anyway, I check the GTmetrix waterfall and these two load a long time after other visible content. I'd like to make the site load faster. I read some stuff on the new Font Load Event APIs (https://docs.google.com/presentation/d/10QJ_GABjwzfwUb5DZ3DULdv82k74QdPArkovYJZ-glc/present?slide=id.g3565fb677_0156) but I don't know enough to parse it?? dunno. It looks really great though!

I have a bing map inside a menu that I tried to ajax but it kept failing to show the map :( so I just put it at the very end hoping it would do its thing after the page was showing.

Anyway, I don't really have any experience with the timeline inside Chrome's dev tools so I cannot really tell if the fonts are a problem or if a lot of jquery work is just eating up all the time in between GETs.

Can someone please look at tv9-d12ab751 (dot) azurewebsites (dot) net and tell me:

a) would inlining the fonts cut the load time by much?

b) what should I do to keep the bing map (virtual earth, veapi, etc.) from blocking rendering?

Thanks.

网友答案:

Bing Maps won't block any rendering. But it is a best practice to load CSS files before JavaScript files and to also place JavaScript files at the end of your page. Since the Bing Maps API sites on a different domain it won't cause any blocking when downloading files.

That said, since the map isn't needed until someone actually goes to the area map section of the site you can delay the loading of the map control until then. You could even delay the loading of the API as well if you want and lazy load it as needed. You could do a quick check when the area map button is clicked/hovered to see if a ma object is already loaded, if not then load the map control and map. This will not only help with loading of the site, but will also mean that the map is only loaded when a user actually wants to see it which will significantly reduce the number of the times the map is loaded. This in turn will generate a lot less transactions and make it much cheaper when it comes to licensing Bing Maps. In fact, depending on the volume of traffic you expect, it may allow you to stay within the free terms of use.

Here is a blog post on lazy loading the map control: http://rbrundritt.wordpress.com/2011/11/20/bing-maps-v7-control-lazy-loader/

分享给朋友:
您可能感兴趣的文章:
随机阅读: