You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a thought, not a priority, but since mojo is also about performance I would personally like to have compiler hints like c++ [[likely]] and [[unlikely]] to set the default branch prediction at runtime (at comptime there is already the amazing @parameter)
Syntax example:
fnfactorial(n: Int) -> Int
@predict(True) # or '@likely'if (n >1):
return n * factorial(n -1)
elsereturn1fnmaybe_get_something(item: Item) -> Optional[Int]
@predict(False) # or '@unlikely'ifnot item.is_valid():
returnNone# do something with itemreturn item.get_some_int()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Just a thought, not a priority, but since mojo is also about performance I would personally like to have compiler hints like c++
[[likely]]
and[[unlikely]]
to set the default branch prediction at runtime (at comptime there is already the amazing@parameter
)Syntax example:
Beta Was this translation helpful? Give feedback.
All reactions