Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

assign v assignByRef

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
macblack77
Smarty Rookie


Joined: 29 Mar 2016
Posts: 13

PostPosted: Wed Sep 28, 2016 9:21 am    Post subject: assign v assignByRef Reply with quote

noob question,

Just curious, but is assignByRef more efficient than assign?

Does smarty access the byref variables directly as opposed to taking a copy of them when you use assign?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Sep 28, 2016 10:43 am    Post subject: Reply with quote

Read documentation. It is only required, when you have very specific needs. Which is an exceptionally rare case in real world applications.
For all other intents and purposes, you must use Smarty::assign().
Back to top
View user's profile Send private message
macblack77
Smarty Rookie


Joined: 29 Mar 2016
Posts: 13

PostPosted: Wed Sep 28, 2016 11:55 am    Post subject: Reply with quote

I read the documentation before posting and if you note I did say "just curious".

I was asking if byref was more efficient?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Sep 28, 2016 1:20 pm    Post subject: Reply with quote

No, it is a http://lmgtfy.com/?q=premature+optimization
Back to top
View user's profile Send private message
macblack77
Smarty Rookie


Joined: 29 Mar 2016
Posts: 13

PostPosted: Wed Sep 28, 2016 1:37 pm    Post subject: Reply with quote

I didn't get that?? Are you saying you agree with me?

I thought it was a perfectly valid question?

Surely there's an efficiency gain (stack/heap processing) in only passing the reference to smarty for vars as opposed to Smarty creating its own copy of each variable?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
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


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP