Using plugin in service vs in page as best performance

Hello
for using some plugin like Social Sharing or Storage , … we can use them in page or use them in service and call from page.

i want to know which scenario is more performance ?

  1. import and use some reusable plugin and function and call them in pages

  2. in any page that we need some reusable function or plugin, import and use it in same page

Thanks

Zero difference wrt performance, however I would recommend doing this in a service for maintenance / futureproofing reasons, in order to concentrate and isolate implementation details.

1 Like