# Performance of writing matrixtable on 0.2

**URL:** <https://discuss.hail.is/t/performance-of-writing-matrixtable-on-0-2/663>\
**Category:** Help \[0.1\]\
**Created:** [September 25, 2018, 8:50pm UTC](https://discuss.hail.is/t/performance-of-writing-matrixtable-on-0-2/663 "2018-09-25T20:50:14Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [September 29, 2018, 12:24am UTC](https://discuss.hail.is/t/performance-of-writing-matrixtable-on-0-2/663/9 "2018-09-29T00:24:13Z")

</div>

for now you can also get down to O(N \* log2 N) doing a tree union:

```python
mts_ = mts[:]

iteration = 0
while (len(mts_) > 1):
    iteration += 1
    print(f'iteration {iteration}')
    tmp = []
    for i in range(0, len(mts_), 2):
        tmp.append(hl.MatrixTable.union_cols(mts_[i:i+2]))
    mts_ = tmp[:]
[final_mt] = mts_

```

---

_[View the full topic](https://discuss.hail.is/t/performance-of-writing-matrixtable-on-0-2/663)._
