python3 code seems shockingly inefficient · Issue #440 · RDFLib/rdflib (original) (raw)
Comparing the typical travis run times of py2 and py3 tests it seems py3 is on avg. taking 2x as long.
This only partially seems to be due to the 2to3 runs and a wild guess of me is that it has to do with some items()
-> list(items())
transformation.
It seems this becomes most apparent in this test:
Python3.4: 86 seconds
test.test_dawg.test_dawg(RDFTest(uri=rdflib.term.URIRef('http://www.w3.org/2009/sparql/docs/tests/data-sparql11/syntax-update-2/manifest#syntax-update-other-01'), name='syntax-update-other-01', comment=None, data=None, graphdata=None, action='file:///home/travis/build/RDFLib/rdflib/build/src/test/DAWG/data-sparql11/syntax-update-2/large-request-01.ru', result=None, syntax=True),): 86.3655s
Python2.7: 49 seconds
test.test_dawg.test_dawg(RDFTest(uri=rdflib.term.URIRef(u'http://www.w3.org/2009/sparql/docs/tests/data-sparql11/syntax-update-2/manifest#syntax-update-other-01'), name=u'syntax-update-other-01', comment=None, data=None, graphdata=None, action=u'file:///home/travis/build/RDFLib/rdflib/test/DAWG/data-sparql11/syntax-update-2/large-request-01.ru', result=None, syntax=True),): 49.0514s
Todos:
- check why test is so slow in general (profiler-runs)
- check if it can be decomposed