0

I have been developing a simulation model in my local environment as a way to learn how to code (I am using PHP). In my current environment it is taking around 30 seconds to run 1 simulation. I was expecting this to be much quicker. My theory is that the local environment has limitations due to shared resources that a standard web server would not have. I used the Laragon installer with it's default settings to configure the local environment. Does this theory hold any water?

Asked more simply: Does a standard web server with default settings compute faster than a local environment with default settings.

gente002
  • 63
  • 1
  • 9
  • 1
    How long is a string? – melpomene Nov 26 '17 at 21:57
  • Why respond if you don’t want to help me? Yes, I’m new. No, I’m not entirely sure what I need to look for/ask. Yes I want to learn. Your comment doesn’t help anyone. – gente002 Nov 26 '17 at 22:02
  • Your assumption that I don't want to help you isn't entirely warranted. – melpomene Nov 26 '17 at 22:06
  • Ok. Well then let me answer your question assuming you were trying to help me. A string has nothing to do with my question and asking how long it is is not helpful or an efficient use of mine or your time. I am trying to figure out if it is possible that my code is running slow because of my local server just not having enough resource. If you were to answer “yes, it is possible” then my next question would be, what are things that I should check? Can I compare them to specs of a very simple web server rented through say Arvixe? If so, what should I look for? – gente002 Nov 26 '17 at 22:14
  • The web server is going to have less resources than your local environment because it will need to serve more people. If your algorithm is taking 30 seconds to run, you need to figure out a way to make it run faster. There are a number of ways to do this, but I can't really say much in the abstract. – xaav Nov 26 '17 at 23:00
  • @xaav Thank you for the response. I was going to upload to a web server to test this theory so this will save me a lot of time and a few bucks. Thanks! – gente002 Nov 26 '17 at 23:09
  • The problem is not when you start off, the problem is when 1000 people are visiting your site and you server doesn't have enough resources to serve them. Usually you can drop down to a lower-level language for CPU-intensive code or use a vectorizing library. – xaav Nov 26 '17 at 23:13
  • That makes sense. Do you have a language suggestion that I can look in to? I have limited experience with C++, which I think would be the closest thing to a lower level language that you are referring to. Any references that you can point me to would be helpful :). Thanks! – gente002 Nov 26 '17 at 23:54
  • @xaav Any suggestions? – gente002 Nov 29 '17 at 02:27
  • Sorry, see for example here https://jaredonline.svbtle.com/creating-a-php-extension-in-rust – xaav Nov 29 '17 at 05:19
  • Or here https://www.phpclasses.org/blog/post/304-How-to-Create-a-PHP-C-Extension-to-Manipulate-Arrays--Part-1-Basic-Array-Class-Extension.html – xaav Nov 29 '17 at 05:21
  • Thanks so much! This was very helpful! – gente002 Nov 29 '17 at 12:54

0 Answers0