adsabs / ADSImportPipeline

Data ingest pipeline for ADS classic->ADS+
GNU General Public License v3.0
1 stars 12 forks source link

quadratic execution #105

Closed romanchyla closed 8 years ago

romanchyla commented 8 years ago

this is a weird code, next() on a list which is created everytime https://github.com/adsabs/ADSimportpipeline/blob/master/lib/SolrUpdater.py#L710

it is quadratic and therefore slow

i also thought i'm not understanding something (some clever design? dict+next update withou replacing?) - but no...it is just wrong usage of an iterator

In [14]: a = [{'a': 'bb'}, {'b': 'cc'}]

In [15]: r.update({'adsdata': next(x for x in a)})

In [16]: a.pop()
Out[16]: {'b': 'cc'}

In [17]: r.update({'adsdata': next(x for x in a)})

In [18]: r
Out[18]: {'adsdata': {'a': 'bb'}}
romanchyla commented 8 years ago

solved in #106