yes, I'm kinda desperate if changing the palettes is really taking so much time. The problem is, you can not access the internal palette map directly to just set the colors. (Which was certainly possible in the old days)
If I look into the SDL code, the call to set the SDL_SetPalette , it seems to do so many weird things like allocating a new memory, running through all colors and map it to something. So it's a pretty busy function.
Knowing that a battlescape screen easely can have around 300 objects to draw...
You will notice that a mission in full daylight will go faster, because I already added an optimization that if the palette does not need to be changed, it doesn't call the palette change function.
The default rate at which the whole screen is redrawn is 10fps (which is the speed of the animation of for example the little arrow above the soldier's head, or animation of fire, smoke and other stuff). All the other frames in between are drawn from the buffer.
The walking animation is at 25fps - unfortunatly it also redraws the whole screen (on top of the 10fps of the animation drawing) - which is 35 times it draws 300 objects from scratch. So yeah, that's more than 1000 calls per second the setPalette function - if it really is allocating and deallocating memory at 1.000 times per second, it is not surprising it has time to only get 150 frames shown on the screen within that second.
I got another trick up my sleeve... which also is used in almost every 2D game (almost certainly in the original x-com as well).... It is called "dirty rects" - it's as nasty to implement as it sounds.
The idea is to only redraw the parts of the screen that have changed on the new frame and get all the rest from the last frame...