Skip to content

GetPropsAsDict very slow when a "long" string property is present & other observations #6352

Closed Answered by bp-kelley
kienerj asked this question in Ideas
Discussion options

You must be logged in to vote

GetPropFromDict is a pretty heavy hammer, partly because it is converting all properties into python types. In this case you might have better success with using the inbuilt python eval here

m = Chem.MolFromSmiles("C"*50)
Chem.MolToSmiles(m)
%%timeit
l = m.GetPropsAsDict(True,True)['_smilesAtomOutputOrder']
996 µs ± 11.6 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
%%timeit
l = eval(m.GetProp('_smilesAtomOutputOrder'))
60.7 µs ± 727 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kienerj
Comment options

Answer selected by kienerj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants