title: Cheapest way to access and modify a struct
body: <p>I am using solidity 0.8.10.</p>
  <p>In my contract I have a state variable struct:</p>
  <pre><code>struct Product {
      uint id_prod;
      address payable producer_addr;
      address payable owner_addr;
      bool onSale;
      }
  </code></pre>
  <p>and a state variable array of products:</p>
  <pre><code>Product[] public ProductList;
  </code></pre>
  <p>and a function that allows to modify the attributes of the product. Nothing really complex.</p>
  <p>Considering the cost in deploying and using the contract, I think there are two ways of changing the attributes of the product.</p>
  <p><strong>Solution 1</strong>, by using a storage variable:</p>
  <pre><code>Product storage _product = ProductList[_id_product];
  _product.owner_addr = payable(msg.sender);
  _product.onSale = false;
  </code></pre>
  <p><strong>Solution 2</strong>, without a storage variable:</p>
  <pre><code>ProductList[_id_product].owner_addr = payable(msg.sender);
  ProductList[_id_product].onSale = false;
  </code></pre>
  <p>Which solution is the cheapest, cleanest, most advisable?</p>