-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor performance improvements for
close!(::MixedDofHandler)
This patch tweaks the dof distribution for `MixedDofHandler` slightly: - `push!` cell dofs directly into `dh.cell_dofs` instead of first pushing to an element celldofs vector and then pushing to the global one. This removes one `append!` per cell, but does not affect the benchmark that much (dict lookup is still dominating). - Use the computed dict token for extraction in `get_or_create_dofs!` - Change keyword arguments in `get_or_create_dofs!` to positional. This does not matter for performance, but gives nicer profile stackframes. I used this benchmark code: ```julia using Ferrite using BenchmarkTools function dofhandler(::Type{DHT}, grid) where DHT dh = DHT(grid) add!(dh, :v, 2, Lagrange{2,RefCube,2}()) add!(dh, :s, 1, Lagrange{2,RefCube,1}()) close!(dh) return dh end grid = generate_grid(Quadrilateral, (1000, 1000)) @Btime dofhandler(MixedDofHandler, $grid) ``` with the following (disappointing) results: ``` 1.605 s (319 allocations: 640.42 MiB) # master 1.573 s (316 allocations: 639.34 MiB) # patch ``` For reference, `DofHandler` gives 1.3s, 405MiB for this benchmark.
- Loading branch information
1 parent
4b330ce
commit 1c5afd5
Showing
1 changed file
with
26 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters