My Python raytracer before I added BVH (aabb.py and bvh.py): https://github.com/RW-77/python-raytracer
After adding aabb.py and bvh.py and slightly refactoring hittable_list.py, my code is much slower.
The BVH tree constructor operates on a HittableList, a list of scene objects, sorting by a random axis and then splitting in half to a left node and right node. This approach is taken from https://raytracing.github.io/books/RayTracingTheNextWeek.html#boundingvolumehierarchies.
I don't know exactly where the problem is. I've tried debugging by creating a BVH.print_tree() method which does a BFS traversal and prints each BVH_Node's bounding box and the type of it's left and right children. Based on this, my tree appears to be constructed correctly. So it may have something to do with how the hit() function is being called.