When it comes to drawing basic flat one-color triangles or polygons, the built in triangle function is going to be the best when it comes to performance. This is because it is in the c++ layer of Makecode. But for the lighting you are looking for, it is probably best to build your own. As far as I know, the fastest way to draw to an image is image.setRows(x, buf)
When it comes to performance and 3D, drawing to the screen is not usually the issue when the screen size is so small, the issue is depth-sorting. I am lazy and use the painter’s algorithm with quicksort, but @kwx has had success using BSP trees, as seen in his game Space Rocks Revenge!