<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62501>62501</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Iterating over elements in DenseElementsAttribute in the python biding is very slow
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vandersonmr
</td>
</tr>
</table>
<pre>
```python
dense_attr = DenseIntElementsAttr(...)
for i in range(dense_attr.__len__()):
.... dense_attr.__getitem__(i)
or
for i in dense_attr:
....
```
This can take minutes if the Dense(Int/FP)ElementsAttr is slightly large.
Is there a way to iterate over these elements faster? Can this Python type be extended and converted to a py:List on the C++ pybind side?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcUkFvozwQ_TXmMipy7JDAgUPafEiRvkMPe48MnsDsGhPZQ7r8-5VD27SVEMh43pv33oyJkXqPWIviWRTHzMw8TKG-GW8xxMmPIWsnu9RCHoU8iJ1cn-vCw-TXnxZ9xLNhDiD0EY7pePL8n8MRPccDcxCqzPNcqGpFXKYABOQhGN-jUOWDIj-fHfrzWagylatK6MMKgjzPc_hW2SMT43ivpk_2KcCPNg_Qd7Yfptbjr4EidMYDmz8II_mZMQJdgAdczQlVnjwL1TSvQlVffQJFiI76gd0CzoQeP3rc36eYSAKCgTezAE9AjMEwwnTDkO4iAr7zwcVExiB0Ay9JTZL1eo8deLkitAj4l9FbtGC8hW7yNwyMNvEauC5CH_6nyJAAA8KLUM9CPcN1aclbiGRR6GYVltla20pXJsN6syu13O3KfZUNtUWlTdFKYwzaTWc220JeKq06W-63e11mVCuptCykUkpvdZVvUF5Ut1fFHs1OmkJsJY6GXO7cbcyn0GcU44z1ThVykznToosfyxfqVPTUzn0UW-kocnzAmNhhfboHRr5fI_sMi_w6m6_ToHZmTDfJ_rqx0JJNYIpww7BAdNNbNgdXD8zXmLZDNUI1PfEwt3k3jUI1ScH75-kapt_YpdnfXUShmruRfwEAAP__KUkM9A">