Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script class initialization is way too slow #78

Closed
Fiusen opened this issue Mar 15, 2022 · 2 comments
Closed

Script class initialization is way too slow #78

Fiusen opened this issue Mar 15, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@Fiusen
Copy link
Contributor

Fiusen commented Mar 15, 2022

Loretta's Script class initialization of a big script takes way too long:

Time on a 20MB file:

  •   Script init: 9s
    
  •   Parse time: 0.9s
    

How to replicate:

  • Have a random script (like allopcodes-5.1.lua) and copy and paste it until ur file gets to ~20MB
var scriptParsed = new Script(ImmutableArray.Create(LuaSyntaxTree.ParseText(code)));
var root = Parsed[0].GetRoot();

SyntaxNode node = root.ChildNodes().FirstOrDefault(); // whatever

scriptParsed.GetScope(node) // long wait here

4KIgA2zjVv

@Fiusen Fiusen added the bug Something isn't working label Mar 15, 2022
@GGG-KILLER
Copy link
Member

GGG-KILLER commented Mar 16, 2022

After quite a bit of profiling, this is not gonna be possible without rewriting the entire scoping code.

Most of the code is being spent in unmanaged code which means that most of the time is probably being spent in array resizes of dictionaries' backing buckets and hashsets' backing buckets and/or virtual calls.

@GGG-KILLER
Copy link
Member

Closing this since #32 will fix this indirectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants