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

Speedup of __add_triple_context #1320

Merged
merged 1 commit into from Jun 26, 2021

Conversation

rchateauneu
Copy link
Contributor

@rchateauneu rchateauneu commented May 17, 2021

Test parsing orkg.nt.

__add_triple_context needs to know if a triple was already inserted. The idea of this speed-up is to:

  • avoid a triple lookup in the dictionary __spo,
  • avoid a KeyError exception, because Python exceptions are expensive.
  • If the triple was already inserted, do not insert it a second time in __pos and __osp.

Before:
image

After:
image

@rchateauneu rchateauneu marked this pull request as ready for review May 17, 2021 16:12
@coveralls
Copy link

coveralls commented May 17, 2021

Coverage Status

Coverage increased (+0.008%) to 75.713% when pulling fec72c9 on rchateauneu:speedup_add_triple_context into 58b23fd on RDFLib:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.0002%) to 75.705% when pulling fec72c9 on rchateauneu:speedup_add_triple_context into 58b23fd on RDFLib:master.

This was referenced May 21, 2021
@nicholascar nicholascar merged commit 69320ab into RDFLib:master Jun 26, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants