Fast and bleeding edge Firefox.. version 7

Firefox 7.0 nightly builds have started and it seems to be quite fast. So, if you dont care about some sites not opening or once in a while your browser crashing, been using for 2 days on Windows , has not crashed so far and worked on all sites so far :), then you should install the Nightly build.

Head over to the nightly build site and install the appropriate build for your OS.

Firefox Nightly Builds

If you really want your browser to be fast, enable pipelining and display render delay, you can follow the following post to do that:

3 Hacks for Firefox That Will Double Your Internet Browsing Speed – Gnoted.com

And to enable the support for your addon’s foll0w the link below:

Check of Firefox 7.0a1 Nightly Build for Disable Addon Compatibility | AbdulRehman.net

With all these now my Firefox process shows only ~130MB memory and decreases to ~12MB when minimized and am really happy with the speed. Also noticeably the CPU used is also quite low compared to Aurora I was using 2 days back 😉

Enhanced by Zemanta

faster bash operations on files with File Descriptors.

I was writing a bash script that would do some operations and read and write to file. Seems that that was pretty simple with

1
2
3
4
5
while read line

do

done<file

and then use redirection operations like “>” and “>>” to write to file. Done with the script pretty fast. So far so good, when I went for real life tests, no one was interested in using it, why? Simple, it was simply taking too long. The file was reading about 10K lines and writing about 50 lines and was taking about more than 10 minutes.

So, I sat down to debug what can increase the performance of the script and one change made the difference. The script was taking a lot of time in opening and closing the file. Pretty evident, isn’t it!!!

When using “>” or “>>”, each operation would require bash to open the file, write to it and close it. Un-necessarily we would be doing a open and close for each write operation. Pathetic and useless waste of CPU power and time. How to avoid this?

Open a file and get the file descriptor. Keep writing to the file descriptor and close the descriptor after you are done with the file operations.

1
2
3
4
5
exec 3> File

echo "" >&3

exec 3>&-

In the above commands,

1
 exec 3> File

will open the file descriptor FD 3

Note that when you are working with FD, you don’t need  “>>” as the echo command will put the statements in the current position of file. So, if you want to append to the file use

1
exec 3>> File

Then you can write to the FD with redirection and finally close the descriptor with

1
 exec 3>&-

HTH

Enhanced by Zemanta

analyze debug queries output for wordpress

Some time back, my website became too slow and I started getting timeout response for quite a lot of my pages. When I analyzed things, I found the issue was with the DB queries taking a lot of time. So, I thought of getting my hands dirty and started with installing the plugin “Debug Queries”. Just in case, you don’t know about the plugin, it lists all the queries to DB along with the time taken for the query when a Admin user visits any page.

The output of the plugin is below the whole page and looks something like this:

45. Time: 0.0030910968780518
Query: SELECT * FROM <>  WHERE <>
Call from: require

Note: The list contains the actual complete query and also all the calls to the query. But as I had more than 40 odd queries, looking at .00 something time was tiresome to find the highest time. So, I copied this text into a text file called “test” and wrote this one line to get me the highest time.

1
sed -n '/.*Time:/ s/.*://p' test |sort -n

Once you have the time, simply search or grep for this values and you know the highest time taking query.

Enhanced by Zemanta