why is c++builder2010 code completion so slow! - c++builder

why is c++builder2010 code completion so slow!

Code completion uses the compiler. The best way to speed up code completion is to make use of optimized precompiled headers. Try the PCH wizard to build up a good .h file to use as your PCH.

Related

Does the amount of files imported in a bridging header affect compile times?

I have a theory, but I don't know how to test it. We have a fairly large iOS project of about 200 Swift files and 240 obj-C files (and an equal amount of header files). We're still on Swift 1.2, which means that quite regularly, the entire project gets rebuilt.
I've noticed that each .swift file takes about 4-6 seconds to compile; in other projects this is at most 2.
Now, I've noticed that in the build output, warnings generated in header files get repeated for every .swift file, which makes me believe the swift compiler will re-parse all headers included in the bridging header. Since we have ~160 import statements in the bridging header, this kinda adds up.
So, basic questions:
Does the size of our bridging header impact build times?
Is there any way to optimize this, so it parses the headers only once?
Does Swift 2 have this same issue?
Any other tricks to optimize this? Besides rewriting everything in Swift, that's kinda too labor-intensive a project for us to undertake at this time.
Does the size of our bridging header impact build times?
Absolutely. The more files included in your bridging header, the more time it takes the compiler to parse them. This is what a Precompiled Header attempted to fix. PCH files have been phased out in favor of Modules.
Is there any way to optimize this, so it parses the headers only once?
To be honest I don't know, it depends on your source files and dependencies.
Does Swift 2 have this same issue?
Yes, but compiler optimization is much better in the newer versions of Xcode and Swift. Again, stressing Modules instead of Precompiled Header files here. I should note that it is possible to pass a pch file directly into clang, but that's rarely a good idea.
If you can, I'd experiment with using a pch header in the hybrid project. I'd also consider creating precompiled libraries or static frameworks to prevent the constant rebuilding of classes. There's a great WWDC video from 2013 which introduces modules, I highly recommend watching it.
References:
Modules and Precompiled Headers
WWDC 2014 Session 404 - Advances in Objective-C
Why isn't ProjectName-Prefix.pch created automatically in Xcode 6?
I can only talk from the experience I have at my previous workplace, meaning some things might have changed. Also, I'm not sure if this helps your specific case, since you mix Objective C and Swift which I have never done, but the theory is still sound.
In short, yes, the size of the bridging header affects compile times and you're correct that it parses it once for every file/inclusion.
The correct way to optimise this seemed to be to split the project up into modules (also called "frameworks" at some point) because each module is compiled individually and thus not recompiled if nothing has changed.

import a non-arc library to project

I try to import a non-arc library(ASIHTTPRequest) to project.
but it reports arc error.
Is there a way to import a non-arc library to arc project?
Your comment welcome
Yes, It is possible to disable ARC for individual files by adding the -fno-objc-arc compiler flag for those files.
You have to add non arc flag -fno-objc-arc in all ASIHttpRequest Classes in ProjectSettings->BuildPhases->Compile Sources
ARC can be disabled on a ASIHTTPRequest files by file basis with the fno-objc-arc flag.
Set the no-objc-arc flag at path ProjectSettings->BuildPhases->Compile Sources->ASIHTTPRequest .m files.
But it is better to use AFNetworking classes for HTTP request handling now.
AFNetworking is best on now days, whereas ASIHTTPRequest is pretty much dead. Additionally, AFNetworking has dozens of great helper libraries and classes available for handling things like OAuth, Amazon S3, and the like.
AFNetworking also available for ARC support.No need to set flag.

How can I exclude certain terms from Xcode's code completion? (auto complete, content assist)

As we all know Xcode's code completion is awesome and necessary at the same time. But sometimes it can be be quite annoying as well...
Is there any way that I can modify the list of possible completion results?
E.g. I'm using "CGSizeMake" all the time, but never want to use "CGSizeMakeWithDictionaryRepresentation" that is suggested in the first place. So I would like to exclude the later one. Another example is "Nil" vs. "nil".
Any information regarding how the code completions works would be appreciated.
I don't believe so. The code completion is generated from indexing the code within the project so anything that is included in the project will be available. Anything that you do to limit the indexing will break the code completion for changes to the code in the project.
Possible options for you include code snippets and, possibly but likely a lot of work, creating an Xcode plugin to try to modify the completion (random sample plugin project).
This is slightly off topic, but you could try using AppCode. AppCode has a much more intelligent auto complete. With AppCode you can also create certain keywords for auto complete as well.

ASIHTTPRequest POST library

I really wanted to use ASIHTTPRequest do to its easy and already built library. Since it is old code format and in the project I use ARC it doesn't really work. Are there any unofficial updates to it or is there other open source code out there that works well? I just find it very tedious to go back through this code and correct it and such.
Consider using AFNetworking in place of ASIHTTPRequest.
Or just disable ARC for ASIHTTPRequest, see #La boa boa
If your new project uses ARC, you can disable ARC for ASIHTTPRequest. Here's a good answer How can I disable ARC for a single file in a project?
The creator of AFNetworking wrote an adapter in order to ease the transition to AFNetworking from ASIHTTPRequest. See https://github.com/AFNetworking/AFNetworking-ASIHTTPRequest
Hope it helps.
Check this answer
https://stackoverflow.com/a/6658549/975959
It allows you to disable ARC for certain files and thus allowing you to use ASIHTTPRequest.
I've used it with that library successfully.

clang(libclang) performance of parse/reparse Translation Unit

I have a question about parsing performance, when using clang(libclang) and particulary function clang_parseTranslationUnit and clang_reparseTranslationUnit.
I'm trying to optimize the process, but I'm really out of ideas already.
The situation is following - I have a .cpp source, that includes a lot of header files. This headers change very seldom. However the .cpp source changes a lot and I need to reparse it often.
So, there is a possibility to "preparse/precompile" all the headers and create .pch file, and then use it when parsing .cpp.
However, the problem is that, I can use only one .pch.
So, I need to create a .pch from all the included headers.
However, later, when I include some other header file, I need to reparse all the headers, even though they hadn't changed at all.
Also, this is problem, that I need explicitly know, what headers are included in the .cpp (this is not very convenient, as this would mean, I have to scan at least for includes myself, and then create a .pch and then use it, when parsing the .cpp source).
Is there any other option to optimize the process? I hoped that, when I use clang_parseTranslationUnit and later clang_reparseTranslationUnit, the parsing will be optimized in this way actually (at least all the headers, that hadn't changed, do not need to be reparsed again). But, it doesn't work like that.

Resources