php - What is faster - grabbing image from folders or grabbing image from a url? -


i've debated in head , input guys @ stack. faster?

i can see grabbing images files fastest since it's local, process of finding files through folders , picking right 1 use processing power.

grabbing image url sending request url , downloading image. while image downloading, other parts of website loading.

when loading page, how server run 1 (or few) processing threads build page? page built in procedural fashion (building 1 thing @ time apposed running @ same time)? difference of procedural php (wordpress) , object oriented php (codeigniter)?

when file via url need connect server. have 2 cases:

  1. server local
  2. server external

if server local may use local ip won't cause dns resolve adress , it's pretty fast server involved.

if server extarnal need use either domain or ip if know it. need calculate speed of connection , speed of server in personal opinion not solution.

about using files. wrote have url defines file is. can same files , give path there's no need find file download it. i'm it's faster solution.

about wordpress , codeigniter it's still php depends how code used. obviosly can write stupid function looks in entire server find file or can specify should or can give path it. it's faster. there nice solutions in php search files , handle them. example iterators or simple glob() function.

to conclude, opinion using files instead urls better solution.


Comments