ionCube Logo
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


 
Post new topic   Reply to topic    ionCube Forum Index -> Programming

Performance difference Javascript inside PHP or external

Author Message
davorin



Joined: 19 May 2010
Posts: 14

PostPosted: Wed May 19, 2010 4:26 pm    Post subject: Performance difference Javascript inside PHP or external Reply with quote

Hello

Is there a big difference when Javascript is embedded into PHP and then encoded? Or is it faster to have all Javascript code being included externally which is then plaintext?

I just like the fact that external opensource libraries are kept readable but own written Javascript code is encoded inside the PHPs (o;
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2757

PostPosted: Wed May 19, 2010 6:25 pm    Post subject: Reply with quote

I'm assuming that you would be inlining the JS in both cases, and there'll be no noticeable difference and probably barely a measurable difference if any at all. If your pages link to external js files then there'll be an extra web request, but that should be minor if already open connections are used, and there's a potential advantage that the JS would be cached and not sent on each web request beyond the first one. This is going to be good if your JS is approaching 100K or more in size, as you wouldn't want to be sending that on each request even if compressed.
_________________
Community Admin
Back to top
View user's profile Send private message
kblessing



Joined: 31 May 2009
Posts: 241
Location: Grand Rapids, Mi

PostPosted: Tue Sep 14, 2010 1:44 pm    Post subject: Reply with quote

izang wrote:
Both JavaScript and PHP are popular tools for the Web developer, but putting them together may be less straightforward than you might think. Back in college my professor advise us to find time to code JavaScript just to exercise our programming skills so it will become easy for us to understand the syntax.


I don't see what that has to do with the OP's question.
_________________
http://ionvz.com
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    ionCube Forum Index -> Programming All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum