3 ms·
Right, and there would also be more semantic boundaries, (possibly greatly) reducing the size of the overall problem space. If (by sheer coincidence) there was
by silentbicycle 18y ago
Right, and there would also be more semantic boundaries, (possibly greatly) reducing the size of the overall problem space. If (by sheer coincidence) there was a token overlap between the last two lines of one function and the first two of another, that's probably not relevant in the same way a copied-and-pasted version of the same function in two places would be.
- scott_s 18y agoThe AST also makes it easier to use heuristics based on semantic information to shorten the number of subtrees you're concerned with (previously substrings). For example, if in a C-like language, you could decide to only look at subtrees that are at least complete statements, or go to a higher granularity and only look at compound statements. You could also eliminate common idioms, such as for (i = 0; i < N; i++) Which will pop up all over the place and give false positives.