0

I have inherited a web site that was designed in php and perl. the code was poorly designed but it has evolved into a very complex system. I am thinking about refactoring the code to make it more readable and more efficient because there is a lot of redundancy and few functions and absolutely no classes.

so I have never coded in ohp and I was wondering if there wi ll be a performance hit if I use classes and storing objects in session variable. the code currwntly has parts that has multiple uses of 4 to 5 dimensional arrays and this procedure gets called. every page they turn to. I was thi nking about using some classes that hold the information instead of multi dimensional arrays. how will this affect performance? would it decrease performance or increase performance? any tips on managing php performance... thanks :)

3
Contributors
9
Replies
12
Views
4 Years
Discussion Span
Last Post by neoanomally
0

@neoanomally

so I have never coded in ohp and I was wondering if there wi ll be a performance hit if I use classes and storing objects in session variable. the code currwntly has parts that has multiple uses of 4 to 5 dimensional arrays and this procedure gets called. every page they turn to. I was thi nking about using some classes that hold the information instead of multi dimensional arrays. how will this affect performance? would it decrease performance or increase performance? any tips on managing php performance... thanks :)

You know it would be much easier if you can post a sample of your code.

The reason why is that it will be easier to see what code you have so far.

By reading the code can let someone or anyone give you some advices how to create or update your current situation.

Right now is second guessing.

Edited by LastMitch: grammer

0

I am more looking for general practices bc I havent sone php... to give examples is hard bc there are 10k plus lines of code which is why I am refactoring. im also indexing some data calls for caching purposes

0

@neoanomally

I am more looking for general practices bc I havent sone php... to give examples is hard bc there are 10k plus lines of code which is why I am refactoring. im also indexing some data calls for caching purposes

There's no general practice. Most websites nowadays have query and database. So the answer you gave is not really helping.

You always want an outline on how you want the website to function

Frontend
Backend
Pages
Database

It looks simple but when you put it together than it's a challenge to make it blend in.

0

oh there is no database for this web site. when it was created the company wouldnt let him use mysql ir use one of their instances of db2.... they thought that maybe 100 people would use this site...since its internal... well by the time he legt there wer e 6000. unique users monthly... now that I have inherited I did some analysis on the logs and there are over 27k unique users... all the data is stored flatfile... I was wanting to make objects to hold the data instead of scanning it and holding in huge multidimensional arrays but I dont know how much performance hit that would create or if it would help it since im unfamiliar with backend programming. .. also I have never dealt with session variables... I was thinking of creating a class that stores all relevant data but I dont know if that would make it less efficient

0

all the data is stored flatfile.

That is very interesting! You didn't mention it at your first post but now it makes more sense with the arrays.

Since you are using multidimensional arrays.

Pro: Save you some space.

Con: It's pain to update the arrays.

I don't see any issue with the performances meaning slowing down your website.

If you upgrade your website from flatfile to query and database. You might have to work on it. It's a lot work it really depend how many files need to upgrade.

0

I was thinking of creating a class that stores all relevant data but I dont know if that would make it less efficient

Here's a novel idea: try it and see what happens. Then you'll know after teaching yourself through experience. ;)

0

thanks for the information haha. I am new to back end development. everything I have made in the past has been very small and performance has never been an issue. as for tryingnit out and see how it goes.. I think that's what im goung ti havr to do but I wanted to make sure it would work and not slow things down. the last 4. months I have been going thru the current code base and commenting. code and looking for redundant code that can be turned into functions etc.. but I would like to improve it so that it will last longer. I know they have looked at commercial and open source replacements but. it would. take so much customizations that it would be too expensive/time consuming. so my job is to take what they have and make some improvements... I have done minor things for more functionality but now im looking to improve the back end so that its easier to modify in the future and look for ways to improve performance. thanks for the help thus far.

0

I wanted to make sure it would work and not slow things down

There's never a guarantee, even if you know what you're doing. Developers historically have been notoriously bad at guessing where performance bottlenecks would be.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.