require versus db select: speed difference
Moderator: General Moderators
require versus db select: speed difference
A database request is essentially reading from disk. So is including a file. Anyone knows which is faster? I assume require but require_once is very slow too.
Re: require versus db select: speed difference
It depends. Databases use all sorts of query optimizations and keep a cache in memory. If there is a cache hit, loading from database is probably faster (no need to load from disk) - so if you request the same resource a lot, you might get better performance that way.
You should probably profile both cases if performance is important.
You should probably profile both cases if performance is important.