Enabling High Level Optimizations in Mojo

Is there a way to enable certain high level optimizations in mojo for user defined types? For example, the expression “a * 0” can be transformed into “0” if a is an integer, but this won’t happen if a is some user defined type (tensor for example) in most languages. Is there a trait that states that any arithmetic operations that work on integers are safe to apply for a specific UDT I create?

1 Like

Not right now, but the team is working on it. See this post.

2 Likes