# How does rclone avoid O(n^2) complexity?

**URL:** <https://forum.rclone.org/t/how-does-rclone-avoid-o-n-2-complexity/24016>\
**Category:** Dev Discussions\
**Created:** [May 4, 2021, 7:08pm UTC](https://forum.rclone.org/t/how-does-rclone-avoid-o-n-2-complexity/24016 "2021-05-04T19:08:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwink3101](https://forum.rclone.org/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@jwink3101](https://forum.rclone.org/u/jwink3101)\
**Post date:** [May 4, 2021, 7:08pm UTC](https://forum.rclone.org/t/how-does-rclone-avoid-o-n-2-complexity/24016/1 "2021-05-04T19:08:08Z")

</div>

This is just out of curiosity, but how does rclone avoid an O(n^2) complexity when comparing remotes? Or does it?

When I built my two sync tools ([PyFiSync](https://github.com/Jwink3101/PyFiSync) and [syncrclone](https://github.com/Jwink3101/syncrclone)), I developed my own data structure ([DictTable](https://github.com/Jwink3101/dicttable)) to do this.

I am sure there are better ways (such as comparing two sorted lists or one sorted list and binary search). Just wondering what, if anything, rclone does?

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://forum.rclone.org/uploads/default/original/2X/3/39ad3235f6ffec76ccd0c81616bd55697b4c300d.png) [@system](https://forum.rclone.org/u/system)\
**Post date:** [July 4, 2021, 3:08pm UTC](https://forum.rclone.org/t/how-does-rclone-avoid-o-n-2-complexity/24016/2 "2021-07-04T15:08:25Z")

</div>

Closed on July 4, 2021, 3:08pm UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
