www.webdeveloper.com
Results 1 to 9 of 9

Thread: Web application optimize/minify it for traffic/bandwidth usage

  1. #1
    Join Date
    Mar 2009
    Posts
    452

    Web application optimize/minify it for traffic/bandwidth usage

    hi all, i m back with another question.

    i m developing on a Web Application Using PHP/MySQL. everything is going fine. now i want to optimize it for traffic/bandwidth usage. i have also tried some trick s to minify HTML and CSS using regex replace also "ob_gzhandler". but i ve got some errors while minifiying Javascripts.

    any tips for making it device friendly

  2. #2
    Join Date
    Mar 2009
    Posts
    452
    Is my Question too hard to answer ? no reply even after more than 100 views

  3. #3
    Join Date
    Jan 2009
    Posts
    3,346
    This reads like a very general description without any specifics...there really isn't much to suggest specifically based on the way the question is asked.

  4. #4
    Join Date
    Mar 2009
    Posts
    452
    I've explained as simple as I could.

    Its a simple web application. and i want to optimize the data transfer load. so that it runs smoothly on smart phones as well as tablet and desktop computers.

    plz let me know what specifics you want to know.

  5. #5
    Join Date
    Jan 2009
    Posts
    3,346
    To put it into a different perspective... Your question is like asking "What should I do to make a good car?" There is no way to answer with anything specific. Each application/site has many different ways it could be optimized, but without seeing any specific concerns or knowing anything about where there might be room for optimization the most anyone can hope to give is generic advice.

    So on that note, I suggest reading articles and white papers on optimization.

    If you run into any specific problems (such as your comments breaking your minifying of your javascript) post back and I'm sure someone will be better able to give you specific advice.

  6. #6
    Join Date
    Jul 2007
    Location
    Wisconsin
    Posts
    468
    Quote Originally Posted by ZABI View Post
    i have also tried some trick s to minify HTML and CSS using regex replace .... but i ve got some errors while minifiying Javascripts.
    what "regex replace" are you using... And what errors are you getting? Those are the first two question I would ask, after from the obligatory "show me some code".

  7. #7
    Join Date
    Mar 2009
    Posts
    452
    here's the function im using for CSS and its working fine.
    Code:
    function compress($buffer) {
        $buffer = preg_replace('!/\*.*?\*/!s','', $buffer);
        $buffer = preg_replace('/\n\s*\n/',"\n", $buffer);
        $buffer = preg_replace('/[\n\r \t]/',' ', $buffer);
        $buffer = preg_replace('/ +/',' ', $buffer);
        $buffer = preg_replace('/ ?([,:;{}]) ?/','$1',$buffer);
        return trim($buffer);;
    }
    but I managed to run it for Javascript after some edits and tests.
    here is the function working for Javascript
    Code:
    function compress($buffer) {
        $buffer = preg_replace('!/\*.*?\*/!s','', $buffer);
        $buffer = preg_replace('/\n\s/',"\n", $buffer);
        return $buffer;
    }
    any thing else you suggest ?
    thanx...

  8. #8
    Join Date
    Jan 2009
    Posts
    3,346
    Quote Originally Posted by ZABI View Post
    here's the function im using for CSS and its working fine.
    Code:
    function compress($buffer) {
        $buffer = preg_replace('!/\*.*?\*/!s','', $buffer);
        $buffer = preg_replace('/\n\s*\n/',"\n", $buffer);
        $buffer = preg_replace('/[\n\r \t]/',' ', $buffer);
        $buffer = preg_replace('/ +/',' ', $buffer);
        $buffer = preg_replace('/ ?([,:;{}]) ?/','$1',$buffer);
        return trim($buffer);;
    }
    but I managed to run it for Javascript after some edits and tests.
    here is the function working for Javascript
    Code:
    function compress($buffer) {
        $buffer = preg_replace('!/\*.*?\*/!s','', $buffer);
        $buffer = preg_replace('/\n\s/',"\n", $buffer);
        return $buffer;
    }
    any thing else you suggest ?
    thanx...
    Hopefully all those processor intensive replace calls are only done once when moving your code into production. Otherwise what little gain you'll get by reduced file sizes will be lost in the processing time it takes to produce the files to the server for sending to the client.

    There are usually several types of things you can look at to speed up a site. Bandwidth required (number of connections needed), file sizes, processing time, memory usage, etc...Focusing on just one of those at the expense of others won't usually show much overall gain in the end.

  9. #9
    Join Date
    Mar 2009
    Posts
    452
    you said right. i m using those functions to compress output before being sent to client so that it requires less traffic as this web application will also be accessed on smart phones. and also the content is database driven so I can just compress the output.

    thanx for your consideration

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles