Smattr / clink

a modern re-implementation of Cscope
The Unlicense
41 stars 2 forks source link

only store relevant line content in the database #162

Closed Smattr closed 1 year ago

Smattr commented 1 year ago

During syntax highlighting, the content of every line of the source file was being stored in the database. However the only content that will later be referred to is that for lines that contain a relevant symbol. For example, if a file contains:

  // the foo API
  //
  // Use this to do foo stuff

  int foo(void);

  int bar(void);

only lines 5 and 7 will ever be needed later. This commit changes the highlighting logic to skip lines like 1-4 and 6 in the above example that contain nothing relevant.

Note that highlighting now implicitly assumes symbol addition has been prior to it running. This is always the case in the current design.

On a sample benchmark (Graphviz commit 536dbfa40f9df5a7510f29f1336829451a40f1aa) this decreases database size from 104MB to 85MB.

Github: closes #134