Determine saving moves for a checked king
Well, you could try to directly use the geometry the attacking piece and possible defenders to see if an intersection is available. This would be faster.
But there is a lot of cases to be taken into consideration : multiple checks, pinned defenders, half-pinned defenders, en passant rules... It's much easier to code that wrong, so be careful, and prepare lots of test cases to compare to the &quot;simple&quot; version, to check that you're not mixing things up.
Computing &quot;long&quot; lists of legal moves isn't hard for a computer, there's less than 200 anyway. What's hard in chess computer programs is the exponential search tree  and deciding when to stop recursing and evaluate.