Skip to content

Commit efe413c

Browse files
committed
expand overlay introduction with base/overlay context
1 parent 4e478c3 commit efe413c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

docs/codeql/ql-language-reference/annotations.rst

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,20 @@ Overlay annotations
508508
===================
509509

510510
Overlay annotations control how predicates behave during **overlay evaluation**, a feature
511-
that enables efficient incremental analysis by dividing QL code into *local* and *global*
512-
parts. During overlay evaluation, local predicates are evaluated separately on "base" (cached
513-
from previous analysis) and "overlay" (newly changed files) data. When a global predicate
514-
calls a local predicate, results from both the base and overlay evaluations are combined,
515-
with stale base results filtered out through a process called "discarding."
511+
that enables efficient incremental analysis of codebases.
512+
513+
In overlay evaluation, a *base database* is created from one version of a codebase, and an
514+
*overlay database* is created by combining the base database with changes from a newer
515+
version (such as a pull request). The goal is to analyze the overlay database as if it
516+
were a fully extracted database at the newer commit, while reusing as much cached data
517+
from the base database as possible. Ideally, analysis time is proportional to the size
518+
of the diff rather than the full codebase.
519+
520+
To achieve this, predicates are divided into *local* and *global* categories. Local
521+
predicates are evaluated separately on base and overlay data, with results combined at
522+
the frontier between local and global code. Global predicates operate on the combined
523+
data. Local predicates typically take time proportional to the diff size, while global
524+
predicates take time proportional to the full codebase.
516525

517526
Overlay evaluation is primarily used internally by GitHub Code Scanning to speed up
518527
pull request analysis. Most QL developers do not need to use these annotations directly,

0 commit comments

Comments
 (0)