Well, it depends what you call fast
The lighting code up until now is maybe just 40 lines, but it took me about 10 hours to write. I have implemented these features before already in my own project, some concepts are carried over from there.
BUT.... and here it comes... in my project the minimum requirement was hardware acceleration (OpenGL or DirectX driven).
It is unplayable without hardware acceleration, because of how I handled the tile drawing. I pumped all sprites into the GPU as textured polygons. The GPU can render tiles this way very fast, including applying shaders to the textures while drawing them.
But in OpenXcom there is no HW acceleration. (...yet. But not let us start the discussion here :p)
I did a first try implementing it like I was used to. But no go: less than 5fps... I had to rethink the whole concept.
The issue was in the fact I had to create a temporary copy of the original sprite, this means creating/allocating a new Surface object and then applying the shading to every one of it pixels, and then blit it. This whole process takes up to 2 milliseconds, which is forever in the world of graphics rendering. That's only 500 sprites per second. Before shading I could blit about 100.000 sprites per second. And as a reference: old/slow GPUs could already shade and blit 10 million sprites per second. FYI the current battlescape viewport contains 400 sprites on average.
So I had to take out the shading process out of the drawing loop. This is from gameplay standpoint no issue, because the shading only changes every now and then. At the start of the battlescape I copy every tile to a "cache". If the shading of a tile changes, I update the cache with the correct shading of the tile. The shading update is done asap for tiles within the viewport and a little later for tiles outside the viewport. In the drawing loop I just blit the cached/pre-shaded tiles.