Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table performance issue: too much info being loaded with __repr__? #36

Open
keflavich opened this issue Nov 22, 2021 · 4 comments
Open

Comments

@keflavich
Copy link
Contributor

I noticed, and I think @miguelcarcamov also noticed, that printing the __repr__ of a Table produced with the standard

import casa_formats_io
from astropy.table import Table
tbl = Table.read('my.ms')
tbl # get the __repr__

can be very slow, while getting the __repr__ of any individual row or column is fast:

tbl[0] # fast
tbl['DATA'] # fast

It looks like there's a bottleneck somewhere in astropy's table formatter - is it perhaps trying to load all the data when making the repr?

@astrofrog
Copy link
Member

It is because it accesses each cell individually which is inefficient dask wise - I am going to investigate ways to speed this up!

@miguelcarcamov
Copy link

@astrofrog please let us know once you have found a way to speed this up!
Cheers

@keflavich
Copy link
Contributor Author

Before #38:

%timeit tables = [Table.read('HD163296_continuum.ms', data_desc_id=ii) for ii in desc['SPECTRAL_WINDOW_ID']]
5min 26s ± 2.22 s per loop (mean ± std. dev. of 7 runs, 1 loop each)

%timeit tables = rslt.as_astropy_table(all_ddids=True)
30.4 s ± 222 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

@keflavich
Copy link
Contributor Author

OK, the __repr__ is much faster now, so 👍. The performance numbers I gave are for reading, and they are not improved - but they shouldn't be from this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants