Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Refactor FEInterface to speed up dof_indices? #101

benkirk opened this Issue · 4 comments

3 participants


I was looking into the DofMap::dof_indices()function to see what I might do to speed it up.

To see just how expensive e.g. FEInterface::n_dofs_at_node() is, I actually had to run the code through the preprocessor to see how all the macros expanded.

What I see is that it becomes a double switch which dispatches to another double switch, and it gets called obviously for each node on the element.

I was thinking about making the current n_dof_at_node() a private member of FEInterface, and using it to build up static arrays, say


but to do this right, it will probably involve cleaning up our FE_FAMILY enum so it is packed, which means writing a string or something instead of a number to the restart files.

@roystgnr, @jwpeterson, @pbauman, @friedmud - Thoughts on this or on the broader issue of FEInterface altogether?



Yaagh. I thought maybe the email-mangling that you guys had noticed had something to do with HTML email, but the quote characters and paragraph breaks in my alpine output just got shredded there.


Isn't "turn switch statements into branch tables" a common compiler optimization anyway? Although that's a compiler optimization we may be inadvertently disabling with our sparse enum. It'd be interesting to start by just packing the enum and seeing if the code gets any faster with g++ or icpc.

It is, but when we have a double switch that then makes a function call to another double switch in a different translation unit and don't usually do inter-procedural optimization I can't imagine a compiler in the world that could do that too efficiently...

As for the restart bit - yes, probably worth its own thread. In the meantime I can have a simple int->string mapping to handle old restart files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.