Merge performance changes from cindex.py #244

Merged
merged 6 commits into from Jan 20, 2013

Conversation

Projects
None yet
2 participants
Collaborator

tobig commented Jan 19, 2013

This pull request syncs our cindex.py again with the upstream cindex.py version. The main reason for this sync are three performance related changes that I committed to the core clang repository. For examples/boost.cpp these changes improve formatting time for me from 0.84 to 0.45 seconds.

tobig referenced this pull request Jan 19, 2013

Closed

Maintenance of cindex.py #241

Owner

Rip-Rip commented Jan 19, 2013

Wow this is a great improvement! I'll wait for your answer before merging those.
Thanks!

tobig added some commits Dec 21, 2012

@tobig tobig Merge: [cindex.py]: Speed up lookup of the completion kind
We can directly the number of the kind instead of going through the
completionChunkKindMap.

Formatting time changes from 0.84 to 0.72 seconds.

https://llvm.org/svn/llvm-project/cfe/trunk@17289
96924a7
@tobig tobig Merge: [cindex.py] Replace CachedProperty with our own implementation
This is a very performance critical point for auto completion. The
manual implementation gives a large speedup. As it does not complicate
the code a lot, I figured it is worth the change. If anybody understands
why the CachedProperty is here so much slower, I am very interested in
working on an improvement of CachedProperty.

Formatting time changes from 0.72 to 0.57 seconds.

https://llvm.org/svn/llvm-project/cfe/trunk@172900
b764ade
@tobig tobig Merge: Fix a copypasto bug. Also rename the parameter in question to not
shadow the 'file' builtin, and fix up a docstring a little.

Hat tip to Sebastian Kreft Carreno at Google for noticing the bug.

https://llvm.org/svn/llvm-project/cfe/trunk@169887
14906a4
@tobig tobig Merge: [python bindings] Expose cursor.referenced (clang_getCursorRef…
…erenced).

Patch by Matthew King!

https://llvm.org/svn/llvm-project/cfe/trunk@171423
64491be
@tobig tobig Merge: [cindex.py] Add cache for CompletionChunk spellings
Most of the CompletionChunks represent braces, colons or other one
character spellings. There is no need to call libclang, to figure out
how to write a colon. Instead we use an internal cache to retrieve the
correct spelling. As function calls from python are very expensive and
this is a performance critical part of auto completion this patch makes
formatting of auto completion results a lot faster.

Formatting time changes from 0.57 to 0.45 seconds

https://llvm.org/svn/llvm-project/cfe/trunk@172901
7fa1d1a
@tobig tobig Merge: [cindex.py]: Use spaces instead of tabs
The tabs slipped in accidentally.

https://llvm.org/svn/llvm-project/cfe/trunk@172934
e8d0f36
Collaborator

tobig commented Jan 20, 2013

  • I fixed the tabs that accidentally slipped in.
  • I do not initialize the __kindNumber immediately as this would cause an unnecessary call in case the kindNumber is not needed. If we figure out the kindNumber is almost always needed, it may be worth to initialize it immediately. However, in this patch I was trying to model the behavior in terms of c function calls. My only goal was to make it faster.

Thanks for your review.

Owner

Rip-Rip commented Jan 20, 2013

Great! Thanks for doing this.

@Rip-Rip Rip-Rip merged commit e8d0f36 into Rip-Rip:master Jan 20, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment