Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7899953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:50:33+00:00 2026-06-03T08:50:33+00:00

I know that serving multiple small files is much slower than serving one larger

  • 0

I know that serving multiple small files is much slower than serving one larger file, this is why it’s good to use a single CSS document as well as sprite sheets. I’ve also tried to include as much JavaScript into the smallest amount of files as I can for a while now, to avoid multiple requests from the viewer for more files, but having a variety of clearly different tasks in the same document gets confusing and messy.

I’ve been wondering if using PHP to combine a larger amount of JavaScript files into a single file and then serving that with the content-type set to application/x-javascript would get around this problem.

I’m assuming that because the server manages retrieving those files, the viewer will only request a single file. I do however have minimal knowledge around how the server will deal with that though, and if it’s going to end up being the same issue just the other way around (and end up just as slow). I have a feeling that because the JavaScript is all hosted in the same place as the PHP that it shouldn’t be the case.

Will I receive the same benefit of only having a single JavaScript file if I actually have multiple files and serve them as a single document via PHP?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:50:35+00:00Added an answer on June 3, 2026 at 8:50 am

    You get the benefit of a single HTTP request to retrieve the JS file, so the browser experience will be faster (at low traffic levels, at least), but your server will be working much harder to execute the PHP code instead of just serving up static files. That may be fine if you don’t get much traffic, but for best results you should combine this technique with a cache layer in front of the PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that all of these will be compiled together into one file but
I know that when linking to multiple static libraries or object files, the order
Ok, I know that serving media files through Django is a not recommended .
I know that I have somewhere inside div on any depth ( maybe one
I have a php application that has about 50-55 code files. The file that
I'm desperately trying to solve this one. I have a bunch of files stored
I'm having trouble serving static files in development mode in Django. I do know
I know that maybe this question has been asked before, but I can't seem
You know Twitter is not serving its widget javascript file over https so I
I know that lot of questions about HTML sanitizers have appeared in SO, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.