Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Provider model and performance

Are there any performance implications with using the provider pattern?

Does it rely on reflection for each instantiation or anything?

like image 551
Loadman Avatar asked Sep 13 '26 10:09

Loadman


1 Answers

Yes, the provider model usually involves a small amount of reflection, and therefore, there is going to be a little bit of a performance hit, however, it is only in the instantiation of the provider object. Once the object is instantiated, it is accessed as normal (usually via an interface). The performance versus a hard-coded model should have very little difference, but the gain you get from the programming perspective far outweighs any performance penalty. Assuming the provider actually may change one day. If not, just hard-code it.

like image 162
Robert C. Barth Avatar answered Sep 14 '26 23:09

Robert C. Barth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!