They are one and the same.
SitecoreContext inherits from
AbstractSitecoreContext which inherits from
If you look at the source code for the latter, you'll see that a call to
Cast<T> as in your sample initiates a sequence of calls which eventually leads to an implementation with the following signature:
public object CreateType(Type type, Item item, bool isLazy,
bool inferType, Dictionary<string, object> parameters,
params object constructorParameters)
Therefore, for optimal performance, your best bet could be to invoke this method directly. I'm not sure how much of a performance difference it will make, however.
If you look at that method's implementation, you can see that it calls
InstantiateObject (from the base class
AbstractService). If you are casting your objects in a loop, you should get a good performance improvement by calling that method directly and reusing the same instance of
Then again, if you need to cast that many items, it's possible that the design needs to be revisited... but hard to say without more information.