questioning_authority icon indicating copy to clipboard operation
questioning_authority copied to clipboard

Optimize Local File Vocab Load

Open no-reply opened this issue 7 years ago • 1 comments

Local vocabularies in a YAML file are read from disk fresh for each call to the #all, #search, and #find operations. This can mean that the full file is read, and the in-memory YAML structure allocated/gc'd multiple times in a typical form operation. This is especially an issue for larger vocabularies

We should optimize this to hold the YAML data structures in memory while the application running. I think this is slightly more complex than a simple instance variable, since the Authority instances may be initialized repeatedly. Something like a singleton wrapping the YAML is probably called for.

See: https://github.com/samvera/questioning_authority/blob/master/lib/qa/authorities/local/file_based_authority.rb#L28

no-reply avatar Aug 15 '17 19:08 no-reply

The configuration yml files associated with the linked data processing side of QA are read in once.

See config/initializers/linked_data_authorities.rb.

This looks in the QA's config/authorities/linked_data directory and the same directory in the app that includes QA. The downside of reading in through an initializer is that it requires a server restart to pick up configuration changes and new configurations. But since these don't change very often, that hasn't been an issue thus far.

elrayle avatar Oct 19 '17 17:10 elrayle