This slows down your implementation a lot because you ask the database for every sub-product separately. If you have 20 sub-products within a selection product, you need 20 database queries. It's much more efficient to fetch the attributes of all sub-products at once and separating them in the view.