-2

I need to write a basic code indexer, which needs to be fast. Should I use an embedded SQLite database for this or should rather rely on a custom data structure, or even flat files as used by ctags?

Some of my requirements:

  • Find all references of a variable.
  • Go to function implementation
  • etc...

Any pointers to docs explaining the theory behind code indexing (and the relevant data structures would be greatly appreciated).

  • I'd imagine you'd need quite a few different data structures here.. – Zavior Apr 6 '18 at 18:21
1

Assuming you use something remotely reasonable for the data structure, the limiting factor on your speed will typically be reading and parsing the source code.

While SQLite can undoubtedly work, in this case you probably have a fairly small number of pre-designed "queries" to support, so using SQL doesn't really gain you much. I'd at least consider something like LMDB or RocksDB. These will probably do everything you need, and they're extremely fast and light.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.