Skip to content
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

improve merge(meshes) #199

Merged
merged 1 commit into from
Jul 18, 2023
Merged

Conversation

JonasIsensee
Copy link
Contributor

Brings allocations down to a fixed number and improves runtime by about x3 in our application.

Note: reduce(vcat, ..) plus broadcasting is faster than mapreduce for some reason

m1 = meshes[1]
ps = copy(coordinates(m1))
fs = copy(faces(m1))
ps = reduce(vcat, coordinates.(meshes))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't this all be written with a single allocated vector for ps and fs, and writing to that in the loop? We should know all lengths

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It surely could.
This was just faster than the more elaborate allocate+loop versions I tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that an acceptable answer to merge this ? ;)

@SimonDanisch SimonDanisch merged commit d5435e4 into JuliaGeometry:master Jul 18, 2023
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants