Skip to content

Conversation

@glennsarti
Copy link
Contributor

@glennsarti glennsarti commented Aug 20, 2019

Fixes #167

Previously the caching in the Language Server created and destroyed a lot of
objects, in particular converting sidecar objects into cache objects, which is
basically the same thing with a little decoration. This object creation/deletion
isn't really needed and causes undue GC stress.

This commit:

  • Changes the cache to use the Sidecar Protocol Objects directly which stops the
    needless creation and destruction of objects
  • Instead of adding the origin method to all cache objects, this commit uses
    hashtable "buckets" to remember which sections and and origins objects should
    be categorised as
  • Removes the PuppetHelper.all_objects method as it needlessly yields yeilded
    objects. Instead callers can use the cache directly
  • Removes the cache_objects source file and tests
  • Adds helpful frozen arrays in the cache class for valid sections and origins,
    although this is not yet enforced
  • Begins to change the providers to use the object cache as a parameter instead
    of through the PuppetHelper module. This is easier for testing.
  • Updates the completion, document_symbol and hover provider with the new cache
    object types and method removals.

Various other maintenance fixes as well.

@glennsarti glennsarti force-pushed the refactor-caching branch 2 times, most recently from 9bafabd to 455bcb0 Compare August 22, 2019 05:53
Previously the message router called `DocumentStore.module_plan_file?` for the
signature provider, however this method was renamed. This commit modifies the
call to use the correct name of `.plan_file?`
Previously the test method was called create_mock_resource however it wasn't
actually creating a resource, it created a type.  This commit changes the name
to be more meaningful
Previously the caching in the Language Server created and destroyed a lot of
objects, in particular converting sidecar objects into cache objects, which is
basically the same thing with a little decoration. This object creation/deletion
isn't really needed and causes undue GC stress.

This commit:
* Changes the cache to use the Sidecar Protocol Objects directly which stops the
  needless creation and destruction of objects
* Instead of adding the `origin` method to all cache objects, this commit uses
  hashtable "buckets" to remember which sections and and origins objects should
  be categorised as
* Removes the PuppetHelper.all_objects method as it needlessly yields yeilded
  objects. Instead callers can use the cache directly
* Removes the cache_objects source file and tests
* Adds helpful frozen arrays in the cache class for valid sections and origins,
  although this is not yet enforced
* Begins to change the providers to use the object cache as a parameter instead
  of through the PuppetHelper module.  This is easier for testing.
* Updates the completion, document_symbol and hover provider with the new cache
  object types and method removals.
Previously the workspace symbols method was added but there were not tests. This
commit adds unit tests.
@glennsarti glennsarti changed the title {WIP} refactor internal cache (GH-167) Refactor Language Server inmemory caching Aug 22, 2019
@glennsarti glennsarti self-assigned this Aug 22, 2019
@glennsarti glennsarti added this to the 0.21.0 milestone Aug 22, 2019
@glennsarti
Copy link
Contributor Author

Self merging

@glennsarti glennsarti merged commit 6ee0252 into puppetlabs:master Aug 22, 2019
@glennsarti glennsarti deleted the refactor-caching branch August 22, 2019 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tech Debt] Refactor Lang Server cache

1 participant