Skip to content

[Optimizer] Conditional Re-Ordering #109

Description

@tinkerer-red

There are some extremely fast conditional expressions true, num = 123, and constants are all generally the same speed. however sometimes it make more sense to write it one way, even if doing it another way would actually be faster. for example this bit of code inside gmlc:

		if (env.isKeyword("enum"))
		&& (currentToken.type == __GMLC_TokenType_Keyword)
		&& (currentToken.value == "enum")

it would actually be faster to parse it like so:

		if (currentToken.type == __GMLC_TokenType_Keyword)
		&& (currentToken.value == "enum")
		&& (env.isKeyword("enum"))

where we prioritize the constant number compare, then the string compare, then the struct look up through 2-3 function calls of a constructor.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions