Payment of ₹ requested by HONEY VIG. Click the link to pay securely via Razorpay: Make 5000 payment Payment of ₹ requested by HONEY VIG. Click the link to pay securely via Razorpay: Make 5000 payment ⭐ If you would like to buy me a coffee, well thank you very much that is mega kind! : https://www.buymeacoffee.com/honeyvig
Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies
Showing posts with label speed. Show all posts
Showing posts with label speed. Show all posts

Tuesday, December 6, 2011

Why Page Weight Still Matters

The dark and mysterious Internet overlords decreed a commandment at the dawn of the Web. All of us followed the rule: thou shalt not create web pages that exceed 50kB in size.
This was understandable back in those unenlightened times. The majority of Internet users had dial-up modems and broadband was an unobtainable dream. Few developers dared go above 100kB, even when fast connections became a reality.
We rarely worry about page weight today. We may use CSS sprites and compressed JavaScript libraries, but only when they’re practical (indeed, do they really make a difference when we fill our pages with 57 Flash adverts?).
But should we care? I recently had the opportunity to work away without a laptop or reliable wifi coverage. Fortunately, I had my trusty Nokia with E/GPRS to help me stay in touch. It’s not 3G, but I didn’t mind waiting for what I thought would be a few extra seconds for pages to load.
fat-laden web pagesBoy, was I wrong. Although email remained usable, accessing the majority of websites was painful. Many pages approached an obese 1MB in size and took a minute or two to appear. I even began to understand why Apple banned Flash — anything that can slim down pages will improve browsing speeds. Perhaps they even considered blocking CSS and JavaScript.
Approximately 10% of Internet users still use dial-up services in the west. That figure is unlikely to drop rapidly; many will be light users or unwilling to pay for a fast connection. There’s also a percentage of users who are unable to access broadband because they live in a remote area.
There’s little need to worry about that 10%, because it’s unlikely to consist of users who are shopping online or using web applications. However, there are two sectors of the community that will experience exponential growth during the next few years:
  1. Internet users from Asia and Africa. Dial-up access and slow broadband will remain prevalent until telecom infrastructures receive a boost.
  2. Those using mobile devices to access the Internet. Connections are improving, but 3G is typically slower than broadband speeds. Besides, the majority of mobile users are either paying per byte or using devices without 3G.
Internet demographics are changing. Although PC/broadband still dominates, the real growth areas are smaller devices with limited processing power and slower connectivity. In the US, mobile data now exceeds voice traffic and Google is predicting that the days of desktop computing are numbered.
It is possible to create a low-bandwidth or mobile version of your website. It may sometimes be impractical or cost more to do, but there are few excuses for not trimming the excess fat from your pages. Reducing page weight makes your application faster and saves hosting costs.
What do you think? Should developers still be concerned about page weight? Should we strive to save every byte? Or are fast connections so ubiquitous there’s little need to care about it?

9 Causes of Web Page Obesity

Broadband speeds are improving but page weight still matters. If your web pages have become a little bloated, spare a thought for those people on slow connections or using mobile devices. Will they buy your services if you make them wait several minutes for your 5MB monstrosity?
It is possible to create mobile or low-bandwidth versions of your website, but few of us have time or resources to create and test multiple versions of content. But there’s little excuse for not keeping in shape — especially when Google could reduce your rank. Leaner pages appear faster, reduce your hosting costs, save your client’s sanity and are environmentally-friendly!
Here are 9 reasons why your site could be piling on the pounds…

1. Over-the-top advertising

We all need to earn a little money but adverts can be the biggest cause of ballooning bandwidth. Most are graphical and many use animation or video to catch the eye.
There are several ways to address adverse advert obesity:
  1. Don’t overdo it. Adverts are distracting and while most web users expect a few, don’t bombard people with dozens of flashing images. Fewer adverts may receive more clicks if your page doesn’t look like promotional puke.
  2. Remove ads which aren’t working. If a huge advert has raised $0.03 in 5 years, perhaps you can make better use of that space.
  3. Try text-based adverts.

2. Inappropriate use of plugins

fat pagesLet’s be frank — I’m talking about Flash. Despite what Apple think, Flash has its good points. But text content, roll-over effects, and simple navigation menus are not the best uses of the technology.

3. Not optimizing images

If there’s one thing I detest, it’s images which haven’t been resized for the web! Digital camera resolutions have reached ridiculously high levels, but no one wants to download a 5,0002 pixel photograph of your dog. Changing the height and width dimensions in the img tag don’t make a difference — you need to resize your images in a graphics package.
When saving, remember to use the best format and highest compression available. In general, photos are better as JPG and graphics are better as PNG or GIF format. However, you will need to experiment with formats and compression rates to squeeze the most from your images.
Finally, keep an eye on Scalable Vector Graphics (SVG). They could revolutionize image production and file sizes if Microsoft keeps its promise to add SVGs in IE9.

4. Not using image sprites

Lots of little images usually sap more bandwidth than a single large image. Each image requires a separate HTTP request/response and most browsers will download a maximum of 4 files at a time. Putting many images into one file then splitting them with the CSS background-position property can save bandwidth. Amazon.com has a great example.

5. Over-reliance on JavaScript frameworks

I’ve nothing against jQuery and similar libraries, but be wary about becoming too dependent on them. Using two or more libraries for effects may also be wasteful.
The W3C website is prime example: it loads a 22Kb file containing jQuery and a plugin to handle basic stylesheet switching. It could have been written in a dozen lines of JavaScript with better browser support.

6. Inefficient HTML

The best HTML is lean, clean and easy to maintain. Your code could be getting out of hand if you find yourself adding 15 nested div tags each with an ID and multiple classes.
WYSIWYG design packages are partly to blame. They have their place, but don’t consider yourself to be a web developer until you have reasonable knowledge of HTML!
Older versions of Visual Studio and ASP.NET web forms can also generate truly shocking and verbose mark-up. Visual Studio has improved, but even previous versions can generate clean code. Be careful when dragging and dropping controls and inspect the resulting HTML.

7. Embedding CSS and JavaScript

CSS and JavaScript should be contained in external files which can be cached and reused throughout every page on your site. There is no excuse for bulking up your HTML with embedded styles and event handlers.
I’d also recommend putting your script tags at the end of the page just before the tag. The page can then be viewed before any scripts are downloaded and executed.

8. Not exploiting CSS cascades or shorthand notation

A little CSS knowledge can go a long way. Novice coders often apply classes to every HTML element and set properties such as font-family within every CSS definition. A little background reading can drastically cut coding time and stylesheet file sizes.
Don’t forget shorthand notation either. The following code snippets are stylistically identical…
Overweight CSS:
  1. #element  
  2. {  
  3.     margin-top: 0px;  
  4.     margin-bottom: 10px;  
  5.     margin-left: 5px;  
  6.     margin-right: 20px;  
  7.     background-color: #aabbcc;  
  8.     background-image: url("myimage.png");  
  9.     background-position: center center;  
  10.     background-repeat: no-repeat;  
  11. }  
Toned-up CSS:
  1. #element  
  2. {  
  3.     margin: 0 5px 10px 20px;  
  4.     background: #abc url(myimage.png) 50% 50% no-repeat;  
  5. }  

9. Not using compression

Your server can gzip files before they’re sent to the browser. HTML, CSS, and JavaScript files can all be compressed by removing comments and unnecessary whitespace. There are many tools and applications to help you squeeze the most from files prior to deployment or automatically at runtime.
Do you know of any other causes of web page obesity? Comments welcome…