1

I have just realized a major slowdown in my app. I use modal dialogs to load other pages of my site into a pop up. Up until recently these loaded very fast. Lately they are taking a vary long time, about 4 seconds. I did some profiling and it seems that my javascript isn't loading asynchronously, each one waits until the other has completed downloading.

enter image description here

This seems to be the major slow down. Each javascript file is just included in the loaded page like so...

<script src="/js/jquery.ae.image.resize.min.js"></script>
<script type="text/javascript" src="/js/jquery.raty.min.js"></script>
<script type="text/javascript" src ="/js/entry.js"></script>
<script type="text/javascript" src="/js/bjqs-1.3.min.js"></script>

I sort of fixed this by moving these files to the page showing the dialogs, but that seems like a hack, especially when they were loading fast enough in the past. Also, this isn't dynamic javascript so it can be cached, I think the time parameters come from $.ajaxSetup({ cache: false }); but that isn't a recent code addition.

3
  • something in your code is probably preventing the fetching of files from cache by adding ?_xxxxxx in js files request. You should address it. Commented Apr 27, 2013 at 13:13
  • I believe that is from $.ajaxSetup({ cache: false }); but that is not new code. Could a new version of jQuery handle that differently? Commented Apr 27, 2013 at 13:16
  • 1
    one solution could be is to load the scripts from different domain names Commented Apr 27, 2013 at 13:17

1 Answer 1

1

If you want to load scripts asynchronously, async attribute helps:

<script async="true" type="text/javascript" src ="/js/entry.js"></script>
Sign up to request clarification or add additional context in comments.

2 Comments

this doesn't help it seems async is for execution not loading of scripts.
davidwalsh.name/html5-async " Each async script executes at the first opportunity after it is finished downloading and before the window’s load event. "

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.