快速排序简便记_性能优化快速简便

快速排序简便记_性能优化快速简便

快速排序简便记

Optimizing your site’s performance doesn’t have to be very difficult. Take this site for example. Typically, I take care of optimization as part of the build process. However, for the sake of demonstration, I thought this time around I’d take care of each step by itself, using freely available tools where applicable.

优化网站的性能并不一定很困难。 以这个网站为例。 通常,我会在构建过程中进行优化。 但是,为了演示起见,我认为这一次我会自己照顾每个步骤,使用适用的免费工具。

First off was setting expires tags and turning gzipping on. Since I’ve done this in too many .htaccess files to count, this was simply a copy/paste job with very little tweaking necessary.

首先是设置过期标签并打开gzipping。 由于我已经在太多的.htaccess文件中完成了此操作,因此,这只是复制/粘贴作业,几乎不需要进行任何调整。

Then, I decided to optimize the images (what few there are). I ran Smush.It from the YSlow tool in Firefox. That compressed the images which I then downloaded to my computer and then promptly pushed right back up to the server. It took me 5, maybe 10 minutes and it cut the image size by about 33% total.

然后,我决定优化图像(数量很少)。 我从Firefox的YSlow工具运行了Smush.It 压缩了图像,然后将其下载到计算机,然后立即将其右推回服务器。 我花了5分钟,也许是10分钟,它使图像尺寸减少了约33%。

The icons for the RSS, Twitter and LinkedIn links in the footer were separate images - each requiring its own HTTP request. By using the SpriteMe bookmarklet, I was able to generate a new sprite and the necessary CSS in a few minutes and trim those 3 HTTP requests down into one. I also ran OptiPng from the terminal window on my Mac on the new sprited image to shave off about 40% of the size.

页脚中RSS,Twitter和LinkedIn链接的图标是单独的图像-每个都需要自己的HTTP请求。 通过使用SpriteMe书签,我可以在几分钟内生成一个新的sprite和必要CSS,并将这3个HTTP请求缩减为一个。 我也跑使用OptiPNG从我的Mac终端窗口的新拼合后的图片上剃掉大小约40%。

I then minimized the CSS and Javascript (what little I was using) using OMG, which shaved ~30% off the file size of each.

然后,我使用OMG最小化了CSS和Javascript(我用的很少),这使每个文件的文件大小减少了约30%。

Without any of these optimizations, my YSlow grade was a C and my page size was about 150K. After the 12 hour investment (if that…I’m being generous here) my YSlow grade came in at an A with a page size around 80K. Not bad for such little work.

没有任何这些优化,我的YSlow成绩为C,页面大小约为150K。 经过1⁄2小时的投资(如果那…我在这里很慷慨),我的YSlow成绩进入A级,页面大小约为80K。 对于这么少的工作来说还不错。

There’s much more I can, and will, do here (caching, data-uri’s, etc.) but the moral of the story is that not optimizing your sites because it takes too long is just no longer an argument you can use. Make use of the tools available to you, and it’s downright scary how quickly you can speed up a site.

在这里,我可以做很多事情,而且会做很多事情(缓存,数据uri等),但故事的寓意是,由于花费太长时间而不对网站进行优化,不再是您可以使用的论点。 充分利用您可用的工具,这真是令人恐惧,您可以加快网站的速度。

翻译自: https://timkadlec.com/2010/02/performance-optimization-made-quick-and-simple/

快速排序简便记