Skip to content

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
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