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
hey all....I'm trying to understand more about how Mojo handles memory management when working with typed Python code. My question stems from the following context and assumptions:
My understanding so far:
Mojo uses an "As Soon As Possible" destruction policy for memory management for Mojo code, not python imports.
For regular imported Python code, I assume Mojo uses CPython's interpreter and its associated garbage collector.
It's been noted that Mojo can significantly "improve the performance of Python code", especially when type annotations are added... but how, if you still use CPython's interpreter..?
My question:
For typed Python code that Mojo can optimize, does the compiler translate it to use Mojo's native memory management system (ASAP destruction), potentially bypassing Python's garbage collector?? If so:
a) How does this translation process work?
b) What criteria does Mojo use to determine if a piece of typed Python code can be optimized in this way?
c) Are there any limitations or edge cases where this optimization cannot be applied?
d) How does this affect interoperability between optimized typed Python code and regular Python code within the same program?
Subquestions....:
It's unclear to me whether this optimization, if it exists, is automatic or requires specific annotations or compiler flags.
I'm uncertain about how MLIR might be involved in this process...
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
-
hey all....I'm trying to understand more about how Mojo handles memory management when working with typed Python code. My question stems from the following context and assumptions:
My understanding so far:
My question:
For typed Python code that Mojo can optimize, does the compiler translate it to use Mojo's native memory management system (ASAP destruction), potentially bypassing Python's garbage collector?? If so:
a) How does this translation process work?
b) What criteria does Mojo use to determine if a piece of typed Python code can be optimized in this way?
c) Are there any limitations or edge cases where this optimization cannot be applied?
d) How does this affect interoperability between optimized typed Python code and regular Python code within the same program?
Subquestions....:
Thanks all
Beta Was this translation helpful? Give feedback.
All reactions