You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the discussion created by @kobytg17 in #599 (brief: we have enormous amount of code in R at our company), I've been reviewing the parsing process and why it's so slow. The main parsing function of this language server is:
Therefore, I'm focusing on finding ways to optimize the parsing. I see two immediate solutions:
Getting rid of step 3 above, since the XML encoding and decoding intuitively seems to be a waste of computation, we must have another way to get the needed parsing features directly.
Implement step 2 (recursively walk on the AST and producing a recursive R Environment object ) in raw C++. Later, if the memory footprints are still high(probably it will be since the result will be the same), we can also change the Environment object to a raw C++ recursive struct or something, and implement some more utility AST functions in C++.
What do you think?
The text was updated successfully, but these errors were encountered:
Following the discussion created by @kobytg17 in #599 (brief: we have enormous amount of code in R at our company), I've been reviewing the parsing process and why it's so slow. The main parsing function of this language server is:
languageserver/R/document.R
Lines 402 to 429 in 1e71561
It seems that the main parsing process, per each file, is done in the following stages:
parse()
function of R.Environment
object.languageserver/R/workspace.R
Lines 243 to 249 in 1e71561
I'm trying to see how can we make this parsing process faster (and hopefully takes less amount of RAM).
One option is to handle this problem like RStudio - have the whole language server written only in C++. They don't have a language server, but their core is written only in C++. For getting the impression, see their tokenizing code here: https://github.com/rstudio/rstudio/blob/02e3810fabbca032fcb664196a1c008e6306ac7f/src/cpp/core/include/core/r_util/RTokenizer.hpp#L346. Of course this doesn't seem to me as a reasonable option because of the huge responsibility and the refactoring.
Therefore, I'm focusing on finding ways to optimize the parsing. I see two immediate solutions:
Environment
object ) in raw C++. Later, if the memory footprints are still high(probably it will be since the result will be the same), we can also change theEnvironment
object to a raw C++ recursive struct or something, and implement some more utility AST functions in C++.What do you think?
The text was updated successfully, but these errors were encountered: