-
Notifications
You must be signed in to change notification settings - Fork 96
change the rules of relativeness preserving to depend on the source file including it for relative path includes #444
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
Conversation
…ile including it for relative path includes
|
Thanks! Let's try this.. |
|
@Tal500 This worked fine. However it did not compile when I merged to master :-( |
|
@Tal500 I am trying to fix it. |
See my comment in 8e5c5f4#r160442750 |
|
@Tal500 I will let you take a proper look at this. As far as I see the new test does fail without the glankk fix. Also.. we have performance issues in simplecpp in windows. and glankk has been able to identify that the |
The fix is clear - please rename the variable of the @glankk commit from the "old" |
My obvious guess is that the performance bottleneck is because of the lock (MyLock). To test if my suggestion is correct, you can omit the lock and measure the performance on a single threaded execution. As far as I can see, you have two options to reduce the intense usage of a lock:
BTW: My guess is that you can improve performance if you'd use BTW2: Isn't there any API in windows to check if a file exist? It might be faster than actually opening the file. I do not understand how file "id" will give better performance than file "name"/"path". |
|
Currently I suggest using file id's instead of path name matching for the slow execution path because it only requires three kernel calls per file (which can maybe be reduced to one with some refactoring), instead of two per path name component plus string operations, which must then also be done for both the relative and absolute case. |
I'm not sure what are the exact behaviour for different paths to the same file, i.e. for symbolic links. According to this blog, symbolic link is consider to be a different file in pragma once for both msvc and gcc. (didn't run a full test) |
ok. My guess is that this has not been an active decision then. The blog says it's a caveat not a feature.
This is the feeling I have actually.
I am basically interested to see if file ids will provide a speedup and simplify the realFileName code. Therefore I suggest that @glankk makes some proof of concept. I do hope you @Tal500 will review and see if there are problems..
This is something we can also test. |
I shall say that according to cppreference, #pragma once is implementation defined behaviour, meaning we need to test the output of compilers in Windows on symlinks, and case insensitive paths, assuming we want to mimic the majority compilers behaviour. |
I don't know yet what the performance difference is. If it's not much faster then I think let's drop file-id and keep existing filepaths code. If file-id would be much faster then:
There is a performance issue with simplecpp when it's executed in windows. I don't think we can solve it but I would be very interested in a improvement. For information, a customer has a project with thousands of source files and it takes several minutes just to preprocess many of those (per file).
Well basically I want that Cppcheck is able to scan code from a wide range of compilers. Tweaks to handle the major compilers better is fine. I.e. handling GCC extensions are fine. |
The specification from danmar/cppcheck#7554 (comment) :
A path (both for (1) top-level source files and (2) header files - i.e. files that are introduced by
#include) will be absolute if and only if at least one of the condition is true:-I) - and this condition is false in that latter case (note that sometimes condition 3 can be true in that case, resulting in absolute flavor).#include "..."): The include path is absolute.-I): The resolved inclusion dir is absolute.Whenever the same file is introduced twice or more, only the first occurrence that simplecpp sees will determine the absoluteness flavor.