/    Sign up×
Community /Pin to ProfileBookmark

OOP: large object includes

I have a photo manager class that controls all photo uploads, resizing, deletes, selects, inserts, updates, and removes.

80% of the time, the class is used only for selects from the database.

Is there any kind of drawback in building a class such as this, where as 80% of the only 20% of the class is being used but the class is included 100% of the time?

I guess my question really is, does every time the file gets included, is it stored in the memory, or does the include look into the memory, realize its already there and use it for processing?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@tsliceauthorJun 10.2008 — I guess nobody has any ideas? I guess I could just test it and see what happens.
Copy linkTweet thisAlerts:
@NogDogJun 10.2008 — include()/require() just call the operating system's disk I/O interface. Depending on the server's physical and software configuration, there is almost certainly some amount of disk caching going on. Therefore, recently/commonly called files are likely to be in that disk cache RAM rather than having to be read from the disk itself. But even if it's not cached, with today's modern disk drives and I/O buses, it's still not going to be a big deal to read a few thousand bytes long file from the disk, and whether it's 1KB or 20KB is going to make a very small difference -- probably negligible in comparison to the network communication time involved in the HTTP requests and data transfers between the server and client.

So to make a long story short, I would not worry about it unless you (a) are noting performance problems and then (b) have performance profiling test results that indicate changing your include file design/usage would make a non-trivial difference. Otherwise, just code things in the way that seems most logical and that will make maintenance of your code as easy as possible.
×

Success!

Help @tslice 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.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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