What is the best way to get baked pose data?

In an import/export script I am writing, I export pose data by stepping through frames in the scene and reading the pose bone matrix on each frame. This method is rather slow since it requires setting scene properties. I tried using anim_utils bake_action, but as it turns out it’s doing the same thing…

Is there a better (more performative) way to calculate and get this data?