|
|
|
|
|
by okraigher
1230 days ago
|
|
One thing that makes it so fast is the multi-core analysis of the code. Internally it parses every file in parallel since at the parsing stage there are no dependencies. When it comes to semantic analysis of the code it will compute the dependency tree and analyze it in parallel while also detecting circular dependencies. The declarations in each design unit are allocated in their own arena allocator. The declarations in one design unit can link to other design units and even create circular references for implicit functions which usually reference the parent type. The reference are direct without having to use the atomic reference counted type Arc. This is because the units are analyzed in dependency order and a dependent unit gets a read-only view of the arena of its dependencies to create direct references. When the user types in the editor the language server will invalidate the modified design unit and any dependencies and just re-analyze those so it is even faster when used interactively then when starting up the first time. Since invalidating a design unit invalidates all dependencies the segmented arena structure described above cannot create dangling pointers. |
|