How to speed up laravel app using socket.io












0














I have a Laravel web app that I developed to use as an eye chart in my office (ophthalmology). So just imagine looking at the chart with the big E and all the letters that get progressively smaller. All my functionality works fine except for speed of execution. When I press a keyboard button, the letters do not change all that fast and it's making me a little sad. I think I've narrowed it down to something with rendering the images? (The letters are actually individual PNG files, not just a font on the screen) But the largest one is like 47kb, not exactly a huge piece of content. The problem that I'm running into is that when I queue a line change, 5 images load on the screen for the patient to read. But they all take a decently long time to load....like 7 seconds sometimes. I'm running an Intel i5 processor that can get 1.9ghz. I really don't think it's that. I'm hosting this locally in the newest apache server on the WAMP stack. If I load lines continually one after the other, the images start to decrease their load time to something more reasonable. But if i let the page sit for 5 minutes then come back to it, it's like it resets and has to reload all the images initially again for 5+ seconds. Does anyone know any potential fix for this? I know it might sound broad but there's so many pieces to this puzzle that I'm not even sure where to start myself. Does chrome auto-cache images? Currently I'm loading them just by calling a reference to the path in the "public/imgs" folder in laravel. Is there a more efficient way to do this? Any help in any direction is appreciated, just want to make this be a little more responsive. Side note: I can stream youtube videos and load image content perfectly fine on other websites, which is why I'm so confused as to why my tiny little image files are taking so long to load. If anyone needs, the github to check this project out is github.com/maximus1127/eyechart. The app is using socket.io, redis, and node. So if you want to download it to play around, you need to configure those things. But the calls and messages get sent almost instantly, i really think it's just image loading trouble.










share|improve this question






















  • In the future, if you post some of your code in the question, you'll get more answers. It's hard to offer suggestions with the code.
    – Peter
    Nov 21 at 23:33










  • Apologies :( i just didn't know exactly which part would be pertinent without posting the whole thing. So i just included a GitHub reference
    – maximus1127
    Nov 21 at 23:35
















0














I have a Laravel web app that I developed to use as an eye chart in my office (ophthalmology). So just imagine looking at the chart with the big E and all the letters that get progressively smaller. All my functionality works fine except for speed of execution. When I press a keyboard button, the letters do not change all that fast and it's making me a little sad. I think I've narrowed it down to something with rendering the images? (The letters are actually individual PNG files, not just a font on the screen) But the largest one is like 47kb, not exactly a huge piece of content. The problem that I'm running into is that when I queue a line change, 5 images load on the screen for the patient to read. But they all take a decently long time to load....like 7 seconds sometimes. I'm running an Intel i5 processor that can get 1.9ghz. I really don't think it's that. I'm hosting this locally in the newest apache server on the WAMP stack. If I load lines continually one after the other, the images start to decrease their load time to something more reasonable. But if i let the page sit for 5 minutes then come back to it, it's like it resets and has to reload all the images initially again for 5+ seconds. Does anyone know any potential fix for this? I know it might sound broad but there's so many pieces to this puzzle that I'm not even sure where to start myself. Does chrome auto-cache images? Currently I'm loading them just by calling a reference to the path in the "public/imgs" folder in laravel. Is there a more efficient way to do this? Any help in any direction is appreciated, just want to make this be a little more responsive. Side note: I can stream youtube videos and load image content perfectly fine on other websites, which is why I'm so confused as to why my tiny little image files are taking so long to load. If anyone needs, the github to check this project out is github.com/maximus1127/eyechart. The app is using socket.io, redis, and node. So if you want to download it to play around, you need to configure those things. But the calls and messages get sent almost instantly, i really think it's just image loading trouble.










share|improve this question






















  • In the future, if you post some of your code in the question, you'll get more answers. It's hard to offer suggestions with the code.
    – Peter
    Nov 21 at 23:33










  • Apologies :( i just didn't know exactly which part would be pertinent without posting the whole thing. So i just included a GitHub reference
    – maximus1127
    Nov 21 at 23:35














0












0








0







I have a Laravel web app that I developed to use as an eye chart in my office (ophthalmology). So just imagine looking at the chart with the big E and all the letters that get progressively smaller. All my functionality works fine except for speed of execution. When I press a keyboard button, the letters do not change all that fast and it's making me a little sad. I think I've narrowed it down to something with rendering the images? (The letters are actually individual PNG files, not just a font on the screen) But the largest one is like 47kb, not exactly a huge piece of content. The problem that I'm running into is that when I queue a line change, 5 images load on the screen for the patient to read. But they all take a decently long time to load....like 7 seconds sometimes. I'm running an Intel i5 processor that can get 1.9ghz. I really don't think it's that. I'm hosting this locally in the newest apache server on the WAMP stack. If I load lines continually one after the other, the images start to decrease their load time to something more reasonable. But if i let the page sit for 5 minutes then come back to it, it's like it resets and has to reload all the images initially again for 5+ seconds. Does anyone know any potential fix for this? I know it might sound broad but there's so many pieces to this puzzle that I'm not even sure where to start myself. Does chrome auto-cache images? Currently I'm loading them just by calling a reference to the path in the "public/imgs" folder in laravel. Is there a more efficient way to do this? Any help in any direction is appreciated, just want to make this be a little more responsive. Side note: I can stream youtube videos and load image content perfectly fine on other websites, which is why I'm so confused as to why my tiny little image files are taking so long to load. If anyone needs, the github to check this project out is github.com/maximus1127/eyechart. The app is using socket.io, redis, and node. So if you want to download it to play around, you need to configure those things. But the calls and messages get sent almost instantly, i really think it's just image loading trouble.










share|improve this question













I have a Laravel web app that I developed to use as an eye chart in my office (ophthalmology). So just imagine looking at the chart with the big E and all the letters that get progressively smaller. All my functionality works fine except for speed of execution. When I press a keyboard button, the letters do not change all that fast and it's making me a little sad. I think I've narrowed it down to something with rendering the images? (The letters are actually individual PNG files, not just a font on the screen) But the largest one is like 47kb, not exactly a huge piece of content. The problem that I'm running into is that when I queue a line change, 5 images load on the screen for the patient to read. But they all take a decently long time to load....like 7 seconds sometimes. I'm running an Intel i5 processor that can get 1.9ghz. I really don't think it's that. I'm hosting this locally in the newest apache server on the WAMP stack. If I load lines continually one after the other, the images start to decrease their load time to something more reasonable. But if i let the page sit for 5 minutes then come back to it, it's like it resets and has to reload all the images initially again for 5+ seconds. Does anyone know any potential fix for this? I know it might sound broad but there's so many pieces to this puzzle that I'm not even sure where to start myself. Does chrome auto-cache images? Currently I'm loading them just by calling a reference to the path in the "public/imgs" folder in laravel. Is there a more efficient way to do this? Any help in any direction is appreciated, just want to make this be a little more responsive. Side note: I can stream youtube videos and load image content perfectly fine on other websites, which is why I'm so confused as to why my tiny little image files are taking so long to load. If anyone needs, the github to check this project out is github.com/maximus1127/eyechart. The app is using socket.io, redis, and node. So if you want to download it to play around, you need to configure those things. But the calls and messages get sent almost instantly, i really think it's just image loading trouble.







laravel






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 at 2:16









maximus1127

389




389












  • In the future, if you post some of your code in the question, you'll get more answers. It's hard to offer suggestions with the code.
    – Peter
    Nov 21 at 23:33










  • Apologies :( i just didn't know exactly which part would be pertinent without posting the whole thing. So i just included a GitHub reference
    – maximus1127
    Nov 21 at 23:35


















  • In the future, if you post some of your code in the question, you'll get more answers. It's hard to offer suggestions with the code.
    – Peter
    Nov 21 at 23:33










  • Apologies :( i just didn't know exactly which part would be pertinent without posting the whole thing. So i just included a GitHub reference
    – maximus1127
    Nov 21 at 23:35
















In the future, if you post some of your code in the question, you'll get more answers. It's hard to offer suggestions with the code.
– Peter
Nov 21 at 23:33




In the future, if you post some of your code in the question, you'll get more answers. It's hard to offer suggestions with the code.
– Peter
Nov 21 at 23:33












Apologies :( i just didn't know exactly which part would be pertinent without posting the whole thing. So i just included a GitHub reference
– maximus1127
Nov 21 at 23:35




Apologies :( i just didn't know exactly which part would be pertinent without posting the whole thing. So i just included a GitHub reference
– maximus1127
Nov 21 at 23:35












1 Answer
1






active

oldest

votes


















1














It looks like the images are getting loaded into the page each time you change a setting. You are adding/removing img elements to the DOM with each change.



$('#line1').html("<img src='/images/" + image[size[1]] + "'/> <img src='/images/" + image[size[2]] + "' /> <img src='/images/" + image[size[3]] + "' /> <img src='/images/" + image[size[4]] + "' /> <img src='/images/" + image[size[0]] + "' />" );


You could try pre-loading all the images once when the page is first loaded, then just hide/show/move them on the page with your jquery code based on the options you select.



<div class="display">

</div>

<div class="hidden">
<img id="size-1" src="/images/...">
...
</div>


Then:



$('.display').append($('#size-1'));


Or something like that ... you get the idea.






share|improve this answer





















  • this actually worked exactly like I needed it to. it sped up the app so fast. great suggestion.
    – maximus1127
    Nov 29 at 1:37










  • Glad it worked out!
    – Peter
    Nov 29 at 14:26











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404412%2fhow-to-speed-up-laravel-app-using-socket-io%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














It looks like the images are getting loaded into the page each time you change a setting. You are adding/removing img elements to the DOM with each change.



$('#line1').html("<img src='/images/" + image[size[1]] + "'/> <img src='/images/" + image[size[2]] + "' /> <img src='/images/" + image[size[3]] + "' /> <img src='/images/" + image[size[4]] + "' /> <img src='/images/" + image[size[0]] + "' />" );


You could try pre-loading all the images once when the page is first loaded, then just hide/show/move them on the page with your jquery code based on the options you select.



<div class="display">

</div>

<div class="hidden">
<img id="size-1" src="/images/...">
...
</div>


Then:



$('.display').append($('#size-1'));


Or something like that ... you get the idea.






share|improve this answer





















  • this actually worked exactly like I needed it to. it sped up the app so fast. great suggestion.
    – maximus1127
    Nov 29 at 1:37










  • Glad it worked out!
    – Peter
    Nov 29 at 14:26
















1














It looks like the images are getting loaded into the page each time you change a setting. You are adding/removing img elements to the DOM with each change.



$('#line1').html("<img src='/images/" + image[size[1]] + "'/> <img src='/images/" + image[size[2]] + "' /> <img src='/images/" + image[size[3]] + "' /> <img src='/images/" + image[size[4]] + "' /> <img src='/images/" + image[size[0]] + "' />" );


You could try pre-loading all the images once when the page is first loaded, then just hide/show/move them on the page with your jquery code based on the options you select.



<div class="display">

</div>

<div class="hidden">
<img id="size-1" src="/images/...">
...
</div>


Then:



$('.display').append($('#size-1'));


Or something like that ... you get the idea.






share|improve this answer





















  • this actually worked exactly like I needed it to. it sped up the app so fast. great suggestion.
    – maximus1127
    Nov 29 at 1:37










  • Glad it worked out!
    – Peter
    Nov 29 at 14:26














1












1








1






It looks like the images are getting loaded into the page each time you change a setting. You are adding/removing img elements to the DOM with each change.



$('#line1').html("<img src='/images/" + image[size[1]] + "'/> <img src='/images/" + image[size[2]] + "' /> <img src='/images/" + image[size[3]] + "' /> <img src='/images/" + image[size[4]] + "' /> <img src='/images/" + image[size[0]] + "' />" );


You could try pre-loading all the images once when the page is first loaded, then just hide/show/move them on the page with your jquery code based on the options you select.



<div class="display">

</div>

<div class="hidden">
<img id="size-1" src="/images/...">
...
</div>


Then:



$('.display').append($('#size-1'));


Or something like that ... you get the idea.






share|improve this answer












It looks like the images are getting loaded into the page each time you change a setting. You are adding/removing img elements to the DOM with each change.



$('#line1').html("<img src='/images/" + image[size[1]] + "'/> <img src='/images/" + image[size[2]] + "' /> <img src='/images/" + image[size[3]] + "' /> <img src='/images/" + image[size[4]] + "' /> <img src='/images/" + image[size[0]] + "' />" );


You could try pre-loading all the images once when the page is first loaded, then just hide/show/move them on the page with your jquery code based on the options you select.



<div class="display">

</div>

<div class="hidden">
<img id="size-1" src="/images/...">
...
</div>


Then:



$('.display').append($('#size-1'));


Or something like that ... you get the idea.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 at 3:30









Peter

8641213




8641213












  • this actually worked exactly like I needed it to. it sped up the app so fast. great suggestion.
    – maximus1127
    Nov 29 at 1:37










  • Glad it worked out!
    – Peter
    Nov 29 at 14:26


















  • this actually worked exactly like I needed it to. it sped up the app so fast. great suggestion.
    – maximus1127
    Nov 29 at 1:37










  • Glad it worked out!
    – Peter
    Nov 29 at 14:26
















this actually worked exactly like I needed it to. it sped up the app so fast. great suggestion.
– maximus1127
Nov 29 at 1:37




this actually worked exactly like I needed it to. it sped up the app so fast. great suggestion.
– maximus1127
Nov 29 at 1:37












Glad it worked out!
– Peter
Nov 29 at 14:26




Glad it worked out!
– Peter
Nov 29 at 14:26


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404412%2fhow-to-speed-up-laravel-app-using-socket-io%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'