Exponential Slowdown of Applescript
It seems the issue isn't with AppleScript, but with Script Editor, after confirming it with a back and forth with an Apple engineer. I'm still not convinced of why this should be the case, but the script runs a lot better when run via osascript, especially after refactoring it to use a whose statement when fetching messages, rather than iterating over them with an if condition.