The slowest line in your code is non-functional (meaning it is not a part of the algorithm, it just logs the info): page.findAll. However page.findChild is also a very slow function.
You are approaching this problem wrong. You need to find not “whether the page contains the node” (very slow method you are using now). You need to simply find the parent page of the node, and this is very easy to do with a while loop or a recursion. Just loop node.parent while it’s not of type "PAGE" and when it is, you just found the page.