Giter Club home page Giter Club logo

Comments (8)

castwide avatar castwide commented on May 25, 2024 1

I found a couple of bottlenecks in the processes that collect completion items. First and foremost, when suggestions include variables, Solargraph will attempt to infer their types from their code signatures. This can be a relatively expensive process, requiring a few hundred milliseconds per variable. When it gets done for several variables in a single request, it can easily add up to several seconds.

Version 0.13.1 of the gem will avoid inferring variable types from signatures when collecting top-level suggestions. It only analyzes the signature when preparing suggestions for method calls on the variable itself. This update is currently committed to solargraph master. Barring unforeseen bugs, I expect to publish the updated gem on Monday.

from vscode-solargraph.

castwide avatar castwide commented on May 25, 2024 1

Gem v0.13.1 and extension v0.9.1 are published.

The gem update is most significant to this issue. The response time for suggestions should be significantly faster, especially at the top-level scope.

from vscode-solargraph.

castwide avatar castwide commented on May 25, 2024

What OS are you using? What are the laptop's hardware specs?

Which version of the Solargraph gem are you using? Version 0.13.0 includes some significant optimizations. More information: castwide/solargraph#9

Other factors that can impact performance:

  • The size of the workspace (i.e., the folder you have open in VS Code)
  • The number of external gems the project is using

In general, certain types of suggestion queries in the outer scope might take longer because of the breadth of namespaces, constants, etc. being queried. Even in that case, subsequent queries should run faster. The server should keep a cache of suggestions from scopes that don't change, such as the Ruby core.

As for current work and upcoming features, there's a public Pivotal Tracker project for the backlog: https://www.pivotaltracker.com/n/projects/1970245

from vscode-solargraph.

AndyBay avatar AndyBay commented on May 25, 2024

os: Windows 10
cpu: Intel Core i7-3537U 2GHz
ram: 8 GB

Solargraph Gem: 0.13.0
Solargraph VS Code Extension: 0.9.0

I tested now again in a new workspace with a simple example class, no speed difference.

I ask because unless I don't remember how to type the specific function/ variable name or if it's just very long, I finish typing before the intellisense kicks in.

I tested the same in C++ which has a lot more functions etc. in the global scope, suggestions comes instantly, so I don't think my laptops poor speed have anything to do with it.

Thanks for the link :) I love to follow the progress 👍

from vscode-solargraph.

castwide avatar castwide commented on May 25, 2024

Cool. Thanks for the details.

I'm still working on performance optimizations for large projects, but with a new workspace and one simple class, you should get nearly instantaneous results. I usually work on a desktop PC, but I have access to a comparable laptop, so I'll install VS Code on it and see how it works.

Even on my workstation, though, it can take 1 or 2 seconds for very large suggestion arrays. I have some ideas to make the server return results faster:

  • Smarter suggestion filtering
  • ApiMap refreshes based on workspace deltas
  • Early caching of YardMap objects in the background

They're the top 3 stories in Pivotal Tracker now.

from vscode-solargraph.

AndyBay avatar AndyBay commented on May 25, 2024

Much better now, under half a second :)

A perhaps unforeseen new bug resulted from this fix comes when you hover over a class name (locally created class). A new entity of the class stacks in the "panel" every time you hover over that same class (name or entity of the class).

class_name_stack_panel

from vscode-solargraph.

castwide avatar castwide commented on May 25, 2024

Confirmed. Thanks for catching that. I'll look into it.

from vscode-solargraph.

castwide avatar castwide commented on May 25, 2024

Bug tracking: castwide/solargraph#12

from vscode-solargraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.