Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Clearing upp all the errors makes it faster?
Old 09-06-2007, 09:24 AM Clearing upp all the errors makes it faster?
Junior Talker

Posts: 2
Trades: 0
Hey guys.

I'm a newb at this forum so tell me if there's anything wrong here.

I am running the largest international StarCraft community out there called the GosuGamers.net. The site's code has been worked on for years and years so it's all a... mess. But I'm trying to make it work faster as the site has so many visitors these days that its really slow.

And when turning on E_ALL for the error handling, I realized that there were about ... I dont know, 250+ errors? I'm sure you've all seen em, here are some examples:

Notice: Undefined variable: seasonid in /var/www/web12/web/match.php on line 1131

Notice: Use of undefined constant column - assumed 'column' in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Undefined index: order in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Use of undefined constant column - assumed 'column' in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Undefined index: order in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Use of undefined constant column - assumed 'column' in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Undefined index: order in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Use of undefined constant column - assumed 'column' in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Undefined index: order in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Use of undefined constant column - assumed 'column' in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Notice: Undefined index: order in /var/www/web12/web/inc/functions/sortable_table_titles.php on line 16

Anyway. They obviously dont cause bugs themselves and might not be urgent to fix. Unless they pose a great threat to speed? And that itself is my question - are these worth to sit down and go through one by one and see what I can do? Will that save any CPU or gain speed in another way?
The site has about 2 million page views a month which is at least some per day. I dont know if that's much comparing to your sites but at least that's heavy comparing to what I usually work with.

I'd be happy for a reply - Thanks!
Mazor is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-06-2007, 09:50 AM Re: Clearing upp all the errors makes it faster?
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
From the looks of it I'd say that there is probably just one or two errors that are manifesting themselves in multiple places. For example say you have a variable x and you reference it in 10 places. If you remove x you have 10 error messages but only one error.

And by the way your traffic is pretty decent, hopefully you've hooked up adsense or something to your site and you're making money.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-06-2007, 09:59 AM Re: Clearing upp all the errors makes it faster?
Junior Talker

Posts: 2
Trades: 0
Hey, thanks.

There's more than just one error everywhere, here are more examples:

" PHP Error [8] [Undefined index: admin_action_log] at 714 in /var/www/web12/web/inc/sides/left.php.
PHP Error [8] [Use of undefined constant smallaction - assumed 'smallaction'] at 3 in /var/www/web12/web/inc/dewbet/smallactions.php.
PHP Error [8] [Use of undefined constant id - assumed 'id'] at 4 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Undefined index: id] at 4 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Use of undefined constant id - assumed 'id'] at 7 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Undefined index: id] at 7 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Use of undefined constant integer - assumed 'integer'] at 10 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Use of undefined constant del - assumed 'del'] at 41 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Undefined index: del] at 41 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Use of undefined constant action - assumed 'action'] at 140 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Undefined index: action] at 140 in /var/www/web12/web/inc/dewbet/sql/savemybet.php.
PHP Error [8] [Undefined variable: query] at 53 in /var/www/web12/web/inc/funktioner.php.
PHP Error [8] [Undefined index: do] at 10 in /var/www/web12/web/match.php.
PHP Error [8] [Use of undefined constant gamesection - assumed 'gamesection'] at 12 in /var/www/web12/web/match.php.
PHP Error [8] [Use of undefined constant gamesection - assumed 'gamesection'] at 14 in /var/www/web12/web/match.php.
PHP Error [8] [Undefined index: sound] at 23 in /var/www/web12/web/match.php.
PHP Error [8] [Use of undefined constant dew - assumed 'dew'] at 32 in /var/www/web12/web/match.php.
PHP Error [8] [Use of undefined constant gg - assumed 'gg'] at 53 in /var/www/web12/web/match.php.
PHP Error [8] [Use of undefined constant id - assumed 'id'] at 71 in /var/www/web12/web/match.php.
PHP Error [8] [Undefined index: id] at 71 in /var/www/web12/web/match.php.
PHP Error [8] [Undefined index: do] at 1141 in /var/www/web12/web/match.php.
PHP Error [8] [Undefined index: do] at 1145 in /var/www/web12/web/match.php.
PHP Error [8] [Undefined index: start] at 1151 in /var/www/web12/web/match.php."

Plus, the real question is whether or not these actually cause a lag on the server?

As for the page views, we're a company and two of us working full time with the site and other coding jobs, so yes it generates some, but not from AdSense though

Cheers.

Jonathan.
Mazor is offline
Reply With Quote
View Public Profile
 
Old 09-06-2007, 11:21 AM Re: Clearing upp all the errors makes it faster?
Ultra Talker

Posts: 483
Trades: 0
"Plus, the real question is whether or not these actually cause a lag on the server?"

I have to disagree: the real question is whether or not you actually understand what these problems mean, why they're there and what can happen in the future.

All of these 'undefined constant' errors are, 9 times out of 10, due to wanting to use strings but not putting quotes around them. That becomes 99 times out of 100 when being used as array indices...

To me, that represents one of two things: someone who doesn't actually understand the code they're writing (especially with that many errors) or just a really sloppy coder (which is worse I think).

The problem is that your code is apparently wanting to use strings but is not: the strings are unquoted so that means they're constants. PHP is looking for those constants and can't find them, so assumes that you actually meant to use a string and so goes ahead with that assumption. Now in this case, technically you probably would see a minute speed up if you quoted the strings correctly (as PHP won't assume a constant, so it won't spend time trying to do a lookup in the constant table).

The bigger problem is that if you continue to have code like this then one day you may actually define a constant with the same name as one of these unquoted strings and set a totally different value to that constant. Then you won't have the error that is being displayed, but a different one.

So. Long story short.... would it speed things up if you fixed these errors? On the server side of things, ever so slightly. From a development stand point: in the future, when you shoot yourself in the foot by defining a constant with the same 'name' as one of those unquoted strings, you will waste a lot of time trying to work it out what happened...
__________________

Please login or register to view this content. Registration is FREE
TwistMyArm is offline
Reply With Quote
View Public Profile
 
Old 09-06-2007, 10:25 PM Re: Clearing upp all the errors makes it faster?
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
It can depend on which version of PHP you are running on your server. Most of the undefined var notices will show more in PHP > 5 because it is notifying you of methods becomming more and more depreciated. The undefined constants can pose a bigger threat because it will try to assume antoher value which could cause unexpected results.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 09-06-2007, 10:37 PM Re: Clearing upp all the errors makes it faster?
Christopher's Avatar
Iced Cap

Latest Blog Post:
Cross-domain AJAX with JSONP
Posts: 3,110
Location: Toronto, Ontario
Trades: 0
Notices are ignored by many developers. Mostly because they are lazy and PHP was built from the beginning allowing the programmer to be lazy. But I'd recommend always writing scripts with E_ALL error reporting. It will mean a bit more work, but the strict rules will mean less bugs for the most part.

The notices here will not cause any noticeable lag. That doesn't mean you shouldn't fix them, though. At least fix the undefined constants errors as the other posters suggest.
__________________

Please login or register to view this content. Registration is FREE
- Latest Articles:
Please login or register to view this content. Registration is FREE
,
Please login or register to view this content. Registration is FREE

--
Please login or register to view this content. Registration is FREE

Christopher is offline
Reply With Quote
View Public Profile
 
Old 09-08-2007, 01:00 PM Re: Clearing upp all the errors makes it faster?
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
This is the problem with big scripts you often find after a while and the little mods and hacks ends up leaving bits of code which end up being useless or which end up conflicting with new mods and that.
and often bits conflict,

Often the best thing to do is to plo through all the code and fix the bit whcih are messed, but usually this is VERY very hard when you are not the person who wrote it.

Again with big scripts differant things can make it slow.

If the script does alot of mysql requests and alot of includes and all the differant bits all slow it down and then throw on top the load time, of all your images and the end html

all adds up, optimise the html, and PHP.

Dan
Talkupation Apprieciated
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Reply     « Reply to Clearing upp all the errors makes it faster?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.42412 seconds with 12 queries