Mysql-Synchronize data-types
Thursday, July 24th, 2008Columns with identical information in different tables should be declared to have identical data types so that joins based on the corresponding columns will be faster.
Columns with identical information in different tables should be declared to have identical data types so that joins based on the corresponding columns will be faster.
<desktop.google.com>: For Windows only - a way to search your computer’s contents faster than any built-in finder function. Works very well when it comes to searching Word documents, AOL IM messages, web searches, etc. You can pause it if you don’t want what you’re doing to be indexed by Google. The information isn’t shared with Google itself (you know this because it works even if you are offline). Be sure to read the FAQ. Mac folks get the same functionality in the Spotlight search built into Tiger, the latest version of OSX.
Instead of going to Google.com each time to search, it’s much faster to have Google built into your browser. Several options:
* My preferred browser for PC or Mac is Firefox <getfirefox.com>, which already has built-in Google. You should download the free Googlebar extension <googlebar.mozdev.org> or the official Google Toolbar <toolbar.google.com> (the Google Toolbar also works on PC Explorer). Faster searches; pop-up blocker; highlighting; word find (go directly to a word/phrase on a page). Be sure to get the Cool Iris extension for Firefox, which lets you preview Google results.
This one really surprised me. I expected these functions to be faster. Both these functions allow you to convert an array into a string. implode is the opposite of explode and join allows you to join the items in an array with a ‘glue’ string. In this case the array had 100 items.
implode vs join
implode: 47.2712550163 seconds
join: 50.1287050247 seconds
Time saved: 2.85745000839 seconds; 5.70022705949%
5% doesn’t seem like all that much but 2 microseconds shouldn’t be ignored.
Tidying up a string breaks the pattern. Maybe my analysis was a little premature.
chop vs rtrim
chop: 4.73731994629 seconds
rtrim: 4.41647195816 seconds
Time saved: 0.320847988129 seconds; 7.26480301852%
rtrim is a little faster and these functions take longer at a little over 4 microseconds.
First up are the sizeof and count functions. They can both be used to count the number of items in an array but does one do it better?
sizeof vs count
sizeof: 3.75928902626 seconds
count: 3.33035206795 seconds
Time saved: 0.428936958313 seconds; 12.8796280262%
The evidence says yes. The count function was over 12% faster in this test. Both functions are fast though taking 3-4 microseconds to count an array with 100,000 items. You might think it isn’t worth it but remember count is also a character shorter. Not only is it faster to run but it is also faster to type!
In PHP, there are a number of loops available for you to use. There are while loops, do-while loops, and for loops. To see which one of these were fastest, I used each of them to perform 100,000,000 iterations. These are the loops which I used:
while(++$a<100000000){}
for(;++$a<100000000;){}
do{}while(++$a<100000000)
Here are my results:
while(++$a<100000000){}: 15.519 seconds
for(;++$a<100000000;){}: 17.577 seconds
do{}while(++$a<100000000): 13.744 seconds
As you can see, my results show that a do-while loop is 21.81% faster, compared to a for loop.
Try to pre-increment, rather than post-increment, where possible. It is faster because post-increment creates a temporary variable while in the process of incrementing. So, this:
++$var;
…is faster than this:
$var++;
This rule also applies to decrementation as well. To test this assertion, I created two for loops. The first for loop used the post-increment option, while the second for loop used pre-increment instead. The total number of iterations was 10,000,000. Here are the results:
Post-increment: 2.148 seconds
Pre-increment: 1.692 seconds
Time saved: 0.456 seconds; 21.23%
Speed Relatively, PHP is much faster and stable than ASP, this is because ASP is built on a COM-based architecture so whenever a program tries to connect to a database or calls for a COM object, there is an overhead on the server, and this COM overhead adds up and slows things down.While in PHP, everything runs in PHP’s memory space , this implies that PHP code will run faster because there is no overhead of communicating with different COM objects in different processes.In addition to this ASP is slower and is a more memory intensive application than PHP’s model because each ASP language compiler runs in its own process.Bottomline: PHP is faster than ASPTo be Continued…
A redesigned page rendering and layout engine means you see Web pages faster—and in the way they were meant to be seen.