# What is the quickest way to iterate over all layers in a document?

**URL:** <https://forums.creativeclouddeveloper.com/t/what-is-the-quickest-way-to-iterate-over-all-layers-in-a-document/6176>\
**Category:** Photoshop\
**Created:** [April 12, 2023, 9:11pm UTC](https://forums.creativeclouddeveloper.com/t/what-is-the-quickest-way-to-iterate-over-all-layers-in-a-document/6176 "2023-04-12T21:11:30Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Maher](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/maher/32/1432_2.png) [@Maher](https://forums.creativeclouddeveloper.com/u/Maher)\
**Post date:** [April 13, 2023, 7:53am UTC](https://forums.creativeclouddeveloper.com/t/what-is-the-quickest-way-to-iterate-over-all-layers-in-a-document/6176/4 "2023-04-13T07:53:46Z")

</div>

[here](http://forums.creativeclouddeveloper.com/t/long-time-to-access-api-data-in-photoshop-v-24/6072/4)

I latest beta changelog it is mentioned that there’s a performance fix for windows , this could be it but I’m not sure.

also someone mentioned the executing in modal could improve performance.

lastly using batchPlay could run faster but I’m not sure how that code would look. maybe look into `multiGet`

edit  
would you try [this](http://forums.creativeclouddeveloper.com/t/why-does-this-code-work-but-this-doesnt/5899/5) method to get all layers and see if anything improves

---

_[View the full topic](https://forums.creativeclouddeveloper.com/t/what-is-the-quickest-way-to-iterate-over-all-layers-in-a-document/6176)._
