However when I draw a map which is 1000 x 1000 32px tiles, memory usage is 300mb and FPS is 19. That's very bad, I need maps of that size in my game.
Well, yes you might need maps of that size in your game, but nobody said you need to render it all, all the time. The only way you would be able to realistically see all the detail would be on a 32000x32000 (1 Gigapixel) screen. Don't give the industry these kinds of ideas yet please
.
Debug and release builds change nothing here. Is it a bug in SFML that memory usage and fps are that bad with increasing number of vertexes? It seems like vertexes are stored in some ineffective way (why they take so much of memory?)
Also I think that vertex array should be stored on GPU side rather than on RAM, correct?
It looks like one vertex takes 65 bytes of RAM which is quite a lot. It should be a lightweight object stored on GPU side I think.
sf::VertexArray stores its data in system RAM for you to manipulate as much as you want. As soon as you draw it, it takes the long journey across your PCIe bus to your graphics RAM and waits there until the GPU renders it to the screen. Keep in mind, this happens EVERY frame because SFML doesn't use VBOs. Given that a single sf::Vertex contains an sf::Vector2f for position data, an sf::Vector2f for texture coordinate data and a sf::Color for color data, that sums up to 2*4+2*4+4*1=20 bytes per vertex. Because sf::Vertex is not polymorphic, the size of its members should constitute its own size. No idea where you got the 65 bytes (or 48 bytes) from... How the data is stored in graphics RAM is another question. It is an internal detail and something we don't need to know about, but I have a feeling it isn't more than the space requirement in system RAM.
If an sf::Vertex is 20 bytes large and you have 1001*1001 of them (1000*1000 tiles) you should end up with an sf::VertexArray of at least 20MB. That leaves the majority of memory consumption to the rest of your application including the baseline that SFML needs to run.
If you are hellbent on displaying that much graphical content on the screen, SFML won't really help you further, you need to code something in OpenGL yourself (you might want to look at VBOs for this). My GPU has no problem rendering a VBO of 2 million triangles every frame.
As Nexus and eXpl0it3r already said, for the panning issue, you need to reduce the amount of stuff you are drawing if you know most of it is offscreen. When zooming out, you can either compute custom mipmaps of regions much like OpenGL does, or you can think of some fancy LOD algorithm that takes care of seamless zooming while keeping the primitive count down. All very advanced topics, but who am I to stop someone from tinkering
.