mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Optimize operators by assuming the types
This assumes that operators are called usually with the same type of operands as the first time. So it stores the types of the first run and if matched it uses an optimized path by calling the validated operator function directly. Otherwise it uses the regular untyped evaluator. With this change, if operators do use the same type they run quite faster. OTOH, if the types mismatch it takes longer to run than they would with the previous code.
This commit is contained in:
parent
202e4b2c1e
commit
c1bca65d09
4 changed files with 78 additions and 21 deletions
|
@ -473,7 +473,7 @@ private:
|
|||
MethodBind **_methods_ptr = nullptr;
|
||||
int _lambdas_count = 0;
|
||||
GDScriptFunction **_lambdas_ptr = nullptr;
|
||||
const int *_code_ptr = nullptr;
|
||||
int *_code_ptr = nullptr;
|
||||
int _code_size = 0;
|
||||
int _argument_count = 0;
|
||||
int _stack_size = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue