Sorry if I'm confusing you.The category definition was superfluous and you'll see I edited that particular post to remove it.
See attached project for you to try, just gets all walls and rooms. To use the command select how many times you want to run each solution and then press Run. The looping just does a bit of averaging to make sure the numbers are as relevant as possible. The usual caveats apply when running these sorts of tests. Don't play mp3's etc while running the tests, and don't start Revit from the debugger
When you run the command for the first time, ignore the first result. So typically I set the loop to 1 and run it for the first time. Then set the loop to 10-15 and run again.
It's a quick hack and taken from a simple command I've used in the past for performance testing different options. I've modified it to give you something relevant to what you're doing. I've also commented the code to try and explain some of it. I typically use the conference project from the training files for tests. It has a bit of everything, a reasonable size without taking 5 minutes to load.
The truth is I am splitting hairs not casting to Elements first, as I do in MyBest
Typically MyBest solution is only about 1% faster than the Better solution. And this is dependent on what you're actually wanting to test. Semantically though it makes more sense to me leaving the current Revit object as an object as long as possible. And it's just as fast to write.
HTH,
Guy