-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[llvm] Remove LLVM functions related to a SNode tree from the module when the SNode tree is destroyed #4356
Conversation
✔️ Deploy Preview for docsite-preview ready! 🔨 Explore the source changes: ec75577 🔍 Inspect the deploy log: https://app.netlify.com/sites/docsite-preview/deploys/6218d2a8f217020007666cc1 😎 Browse the preview: https://deploy-preview-4356--docsite-preview.netlify.app |
Well done! import taichi as ti
from tqdm import tqdm
if __name__ == "__main__":
ti.init(ti.cpu)
iterations = 10000
for i in tqdm(range(iterations)):
x = ti.field(ti.f32)
fb = ti.FieldsBuilder()
fb.place(x)
snodetree = fb.finalize()
snodetree.destroy() |
But we will still have performance downgrade when the number of allocated and not destroyed SNodeTree is large. Try this. import taichi as ti
from tqdm import tqdm
if __name__ == "__main__":
ti.init(ti.cpu)
iterations = 2
snode_tree_num = 1000
for i in range(iterations):
snode_trees = []
for j in tqdm(range(snode_tree_num)):
x = ti.field(ti.f32)
fb = ti.FieldsBuilder()
fb.place(x)
snodetree = fb.finalize()
snode_trees.append(snodetree)
for snodetree in snode_trees:
snodetree.destroy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Co-authored-by: Ye Kuang <k-ye@users.noreply.github.com>
/format |
Related issue = #4023