Tech geek. Life geek.

Tag: Optimize

Day 6 – Two Week Campaign

To make the site clean and faster loading, I remove one piece advertising script.
The ads removed is provided by Kontera, I used it for many years. It is a content link ads. It mimics text link. When mouse move over it, a small float layer display a small box with ads. About five to ten Kontera links are added on each of my post. Now I took it away. The page looks less links on it.
The second change I made is to move Google Ads from the middle center of the post content to the right up inline of the post. Personally, I feel better look. And more content will be shown above the fold.
After the above two changes, the Fully Loaded time is reduced about 25% on first view.

Continue reading

System Mechanic 10.8

I test the System Mechanic 10.8 on my Windows XP sp3 in my office. Installation is pretty simple.
It is one of the best PC tune-up / PC utility tools I used up to now.
First, speed is very important. If the loading speed of the tool itself is slow, I will have no confidence on its functions. System Mechanic has good loading speed.
iolo System Mechanic® - Fix, Speed Up Your PC ...Automatically
Second, I do like all-in-one solution for this type of tools.

  • Fixes errors, crashes and freezes
  • Boosts internet speeds
  • Speeds up Windows start time
  • Restores system stability
  • Cleans out clutter and junk files
  • Prevents slowdowns and bottlenecks
  • Plugs security holes
  • Clears out private data
  • Improves gaming experience

Continue reading

YUI compressor 2.4.2 vs 2.4.7

CSS file can be compressed by YUI compressor of Yahoo.
I used to use v2.4.2 to do it. Now I saw YUI compressor 2.4.7 released.
Let me see how big difference of them.
One normal CSS file, which can be easy to read and edit.
File size 74,032
I use 2.4.2 to compress it. I got a file size 49,943
I use 2.4.7 to compress it. I got a file size 49,164 (2% less of 2.4.2)
Look at the release notes below, there are not many big changes of it. Most of them are fixs.
Yes. New version did make the file smaller.
Now, it is 66% of the original CSS file.
YUI Compressor 2.4.7
+ Handle data urls without blowing up Java memory (regex)
+ Updated docs to reflect Java >= 1.5 required for CssCompressor
+ Fixed issue where we were breaking #AABBCC id selectors, with the
#AABBCC -> #ABC color compression.
YUI Compressor 2.4.6
+ Show usage information when started without arguments.
YUI Compressor 2.4.5
+ Default file encoding changed from system default to UTF-8.
+ Errors/messages/usage info all are sent to stderr.
+ Removed unnecessary warning about short undeclared global symbols.
+ Added support for processing multiple files with a single invokation
+ $ in CSS files doesn’t throw exceptions
+ white space in ! important comments preserved in CSS
+ fix in greedy empty CSS declaration blocks removal
+ safe handling of strings and comments in CSS files
+ shorter alpha opacity CSS filers
+ shorter Mac/IE5 hack -> /*\*/ hack {mac: 1} /**/
+ JS port of the CSS minifier
+ safe @media queries handling
+ stripping the trailing ; in CSS declaration blocks
+ shorter border:none->0 where applicable
+ fixed transform-origin: 0 0 [bug 2528060]
+ tests++
YUI Compressor 2.4.4
+ Interim 2.4.5 release
YUI Compressor 2.4.3
+ Changed custodian to ci-tools@

Continue reading

WebPageTest has new UI

I do like to mod my Blog time by time. And also check the performance of website often.
Now, I find UI of one of the best testing sites is changed. It is WebPageTest.
The new look is clear and fast.
OK, the point is not his UI or performance. I am talking about my blog. How fast it is loaded and easy to navigate.
To optimize my blog, I implement to speed up.
0) Merge CSS files into one CSS file.
1) Use minify tool, or Yuicompressor from Yahoo,to minify CSS and JS files.
2) Use CDN, Amazon CloudFront, to serve some static files, including CSS, JS, Images.
3) Enable gzip for CSS and JS and Html.
4) Add longer expiry date for static files.
The testing result of David Yin Blog shown as blow.

Continue reading

Optimize JS in MovableType

Everyone knows my blog is powered by MovableType. Actually I start to blog from MovableType 3.11.
There is a mt.js file in root of the blog. It is 20K after generating by MovableType 4.26.
Then to make it smaller. I use Yuicompressor which is provided by Yahoo Developer Network.
Then it is only 13K. And also I use gzip compress facility on Apache server. It is 4.1k when transferring to Web Browser.
Actually before minifiy its gzip size is 5.8K.
So it is clear to make a list.
Original mt.js
20.2K, gzip version 5.8K
Minified mt.js
13.1K, gzip version 4.1K

Continue reading

Another Ten PHP Optimization Tips

I wrote PHP Optimization to improve performance. Now I have another ten PHP optimization tips for you.

1. Single-quoted strings.

Use single quote when possible. It is faster than double quote.
If it is string only, just pick single quotes.

2. The way output data.

Could you point which is the fastest way to output from below?

print "Hi my name is $a. I am $b";
echo "Hi my name is $a. I am $b";
echo "Hi my name is ".$a.". I am ".$b;
echo "Hi my name is ",$a,". I am ",$b;

The last one is actually the fastest operation.

3. Use single-quotes around array indexes.

So, $x[‘sales’] is alway best format and fast.

4. Don’t use short open tags.

<?php is formal tag.

5. Use regular expressions only when you really need it.

When doing string operation, like replace part of string.
strtr is the fastest.

str_replace is faster.

preg_replace is slow.

Continue reading

PHP Optimization to improve performance

When coding in PHP in variety ways, some way is simple, some is not. But there must be one better way that can provide better performance.
Here is a list of 63+ best practice to optimize PHP code performances
I learn some from it.

  • echo is faster than print.
  • require_once() is expensive
  • If you need to find out the time when the script started executing, $_SERVER[‘REQUEST_TIME’] is preferred to time()
  • str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4
  • It’s better to use select statements than multi if, else if, statements.
  • Close your database connections when you’re done with them
  • $row[‘id’] is 7 times faster than $row[id]
  • Do not use functions inside of for loop, such as for ($x=0; $x < count($array); $x) The count() function gets called each time.
  • When echoing strings it’s faster to separate them by comma instead of dot. Note: This only works with echo, which is a function that can take several strings as arguments.
  • Do NOT use SQL wildcard select. eg. SELECT *

© 2020 David Yin's Blog

Theme by Anders NorenUp ↑