/    Sign up×
Community /Pin to ProfileBookmark

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

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@ZABIauthorFeb 24.2012 — Is my Question too hard to answer ? no reply even after more than 100 views ?
Copy linkTweet thisAlerts:
@criterion9Feb 24.2012 — 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.
Copy linkTweet thisAlerts:
@ZABIauthorMar 01.2012 — 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.
Copy linkTweet thisAlerts:
@criterion9Mar 01.2012 — 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.
Copy linkTweet thisAlerts:
@OctoberWindMar 01.2012 —  i have also tried some trick s to minify HTML and CSS using regex replace .... but i ve got some errors while minifiying Javascripts.[/QUOTE]

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".
Copy linkTweet thisAlerts:
@ZABIauthorMar 04.2012 — here's the function im using for CSS and its working fine.
[CODE]
function compress($buffer) {
$buffer = preg_replace('!/*.*?*/!s','', $buffer);
$buffer = preg_replace('/ns*n/',"n", $buffer);
$buffer = preg_replace('/[nr t]/',' ', $buffer);
$buffer = preg_replace('/ +/',' ', $buffer);
$buffer = preg_replace('/ ?([,:;{}]) ?/','$1',$buffer);
return trim($buffer);;
}
[/CODE]


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('/ns/',"n", $buffer);
return $buffer;
}
[/CODE]


any thing else you suggest ?

thanx...
Copy linkTweet thisAlerts:
@criterion9Mar 04.2012 — here's the function im using for CSS and its working fine.
[CODE]
function compress($buffer) {
$buffer = preg_replace('!/*.*?*/!s','', $buffer);
$buffer = preg_replace('/ns*n/',"n", $buffer);
$buffer = preg_replace('/[nr t]/',' ', $buffer);
$buffer = preg_replace('/ +/',' ', $buffer);
$buffer = preg_replace('/ ?([,:;{}]) ?/','$1',$buffer);
return trim($buffer);;
}
[/CODE]


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('/ns/',"n", $buffer);
return $buffer;
}
[/CODE]


any thing else you suggest ?

thanx...[/QUOTE]


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.
Copy linkTweet thisAlerts:
@ZABIauthorMar 05.2012 — 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
×

Success!

Help @ZABI spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.1,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...