So you call it with
Local AnInstance:MyType = Mytype.Create(New MyType) As opposed toLocal AnInstance:MyType = Mytype.Create() Which would mean you also had to take into concideration the Call functions speed.
It may be faster, It may not, however (And this is just for me), I dont have NEW in open code at all, (Yes I do see that its only a small consetion to this rule, but there you go. Also I have this as my normal setup
Function Create:MyType ()
Return New Mytype.Allocate()
end Function Were Allocate is doing really what your second Function is doing, but with the benifit that I have effectivle both functions you have described. (This way makes overriding easier)
I would say on a different note, that I would try and not create any object in time critical operations. This would include (say) bullets which I would not create in Loop time, but would rather already have an array of Non-displayed bullets ready (for example). So its my feeling that even if there is a slight sdeed increase in your second method, the inconvenience of haveing to add NEW to ever Create wouldnt be worth it.
It would however be interesting to find out which of the two fucntions and calls is faster
|