Don't pick a fixed value for the batch size; render until your time is exhausted and then wait for the next batch. Yes, this'll be slower overall, but you ensure that the app stays responsive regardless of device or CPU availability.
You might want to check out this thread from last week[0] about scheduling tasks when the event loop is idle. The author also published a library for it[1]