mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Add faster operator for known types
It now uses the direct operator function pointer, which increases performance in evaluation.
This commit is contained in:
parent
c707d6fe71
commit
1ad5c926dc
5 changed files with 77 additions and 3 deletions
|
@ -159,6 +159,7 @@ class GDScriptFunction {
|
|||
public:
|
||||
enum Opcode {
|
||||
OPCODE_OPERATOR,
|
||||
OPCODE_OPERATOR_VALIDATED,
|
||||
OPCODE_EXTENDS_TEST,
|
||||
OPCODE_IS_BUILTIN,
|
||||
OPCODE_SET,
|
||||
|
@ -241,6 +242,8 @@ private:
|
|||
int _global_names_count = 0;
|
||||
const int *_default_arg_ptr = nullptr;
|
||||
int _default_arg_count = 0;
|
||||
int _operator_funcs_count = 0;
|
||||
const Variant::ValidatedOperatorEvaluator *_operator_funcs_ptr = nullptr;
|
||||
const int *_code_ptr = nullptr;
|
||||
int _code_size = 0;
|
||||
int _argument_count = 0;
|
||||
|
@ -256,6 +259,7 @@ private:
|
|||
Vector<Variant> constants;
|
||||
Vector<StringName> global_names;
|
||||
Vector<int> default_arguments;
|
||||
Vector<Variant::ValidatedOperatorEvaluator> operator_funcs;
|
||||
Vector<int> code;
|
||||
Vector<GDScriptDataType> argument_types;
|
||||
GDScriptDataType return_type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue