The memory limit is actually much lower than 8MB, shared hosts will start bitching at about one megabyte depending on your traffic.Roja wrote:Its an especially odd opinion for a programming language that has a default 8mb limit that is rarely changed on any host I've seen.
Classes or Functions, that is the question?
Moderator: General Moderators
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
Hmm. Tough question to define. My cheap answer is to say, "You know it when you smell it", but thats cheating.McGruff wrote:I don't know what you mean by that.Roja wrote:I put it at the level where the relationship between data and processing gets strong.
I'll try to explain in a future post.. I want to give a solid definition that is defensible, and being totally honest, its something I'm having a hard time defining in absolute (read: not subjective) terms.
heh. Well, fair enough.. if you had a million users each using 1mb of memory per page, yes, I think any reasonable host would complain. But by that token, there is no reasonable limit.Buddha443556 wrote: The memory limit is actually much lower than 8MB, shared hosts will start bitching at about one megabyte depending on your traffic.
Even at just one user, the ceiling is at 8mb, and I have done plenty of things that cannot be done in 8mb without some interesting gymnastics.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
You'll never get a straight answer out of a shared host about resource limits beyond web space and bandwidth. Too many variables involved. The 1 MB limit has nothing to do with PHP and is just my observation, it's just seems to be the point where a host will take an interest in what your doing. A user with 10 processes on TOP will also usually perk their interest too. These are limits I have to live with on shared servers but if I keep my pages small and fast the limits are no problem.Roja wrote:heh. Well, fair enough.. if you had a million users each using 1mb of memory per page, yes, I think any reasonable host would complain. But by that token, there is no reasonable limit.Buddha443556 wrote: The memory limit is actually much lower than 8MB, shared hosts will start bitching at about one megabyte depending on your traffic.
Even at just one user, the ceiling is at 8mb, and I have done plenty of things that cannot be done in 8mb without some interesting gymnastics.
- Buddha443556
- Forum Regular
- Posts: 873
- Joined: Fri Mar 19, 2004 1:51 pm
In all fairness he was only defending himself.. and besides the other guy went off-topic, if anything Buddha443556 broke the rules by being cynical in saying "the only one that thinks its.... is you", he was not respecting mcgruff's views.patrikG wrote:Let's keep cynicism out of this, not engage in a meta-discussion and stick to the topic that is being discussed here.
Yes, and you opened the door for this part of the discussion. Your quote was:McGruff wrote:Is this relevant to functions v classes?
I responded that that was not accurate at all, and that the 8mb limit in php is a significant issue. What I didn't see was that you then asked a relevant question:McGruff wrote:In any case, programming isn’t about squeezing every last drop of performance out of your code. The days of “64k should be enough memory for everyone” (an old Bill Gates quote) are long gone.
To answer the first, please don't assume to know what I know - its clear here that you are no mind reader. In fact, I asked on these very forums for help with optimizing a portion of the game I work on to fit under 8mb. It's an issue I've faced roughly numerous times in my game programming, so clearly your experiences are vastly different than mine.McGruff wrote:Are you saying that it is common to run up against the 8mb limit in practice? Of course, as you know, it isn't.
Also, did you mean to suggest that using functions or classes is going to significantly affect this?
So I answer back, YES, it is common for ME to run up against the 8mb limit in practice. Memory optimization definitely matters.
However, the whole thing is a wash, because it only puts emphasis on whether functions or classes has an advantage in memory use, and I would argue that neither does. Even if you want to get very specific, and give gory details of specific classes that aren't optimized-to-the-bone to prove that they are less memory efficient, I'd still argue that the difference is pointless.
As always, I argue that the difference between classes and functions is one of preference, and degree, and not provable superiority in every situation.
OK apologies if I assumed too much. I've only once hit the memory limit myself and I don't often hear people talk about it.Roja wrote:YES, it is common for ME to run up against the 8mb limit in practice. Memory optimization definitely matters.
Really all I wanted to do was check if someone was suggesting that memory usage was a reason to pick one of functions or classes over the other.
Yes, someone did - sort of.McGruff wrote:Really all I wanted to do was check if someone was suggesting that memory usage was a reason to pick one of functions or classes over the other.
However, Infolock also stated that he (apologies if that is the wrong pronoun) would use whichever method (class v. functions) worked better in a given situation, where better = less overhead/load time.Infolock wrote:The best method is the method that will in the long run, lessen the overhead/load time.
I can't say I disagree with that position. If I found that OOP (in some odd corner-case) was dramatically slower than Procedural code, I would be likely to replace it with Procedural, and document in the file why I did so.
I take it you wouldn't?
But this does go back to the overall point.. what is "better"? OOP might be more maintainable, and more scalable in that situation. Does that make it better if its slower? OOP might be more understandable by the programmers working on the code. Does that make it better if its slower?
I think it comes down to a matter of which better is better! heh.. but seriously, the discussion around OOP and procedural requires that basic definition - what are we defining as better?
If we accept some tradeoff in any area, then we should also accept that it is in fact a matter of preference. I would posit that in fact its impossible to say that EITHER is always going to be better in every category, in every situation.
As a result, one person might prefer more optimized code, while another might prefer more maintainable code. Thus, my point: One size does not fit all, and OOP v. procedural is a matter of preference.
To be honest I'm completely burnt out with the whole thing. In the end all I have to say to anyone reading the thread is just trust me: all the concerns you hear about OOP will just melt away into irrelevance once you really start to learn about programming. Read some Fowler, learn all you can about design patterns and the agile movement, start unit testing.
Once you've done that, then do as I have.McGruff wrote:To be honest I'm completely burnt out with the whole thing. In the end all I have to say to anyone reading the thread is just trust me: all the concerns you hear about OOP will just melt away into irrelevance once you really start to learn about programming. Read some Fowler, learn all you can about design patterns and the agile movement, start unit testing.
Come back, and look further into the world of programming, and realize that the screws of the world don't need hammers.
Explore the discussions at sites like this one, and dozens of others, and see that there is no consensus stating that everything should be 100% OOP. On the contrary, most discussions are on where the balance should be between OOP and procedural.
But regardless, keep asking questions.