Bad performance on Windows compared to XNA and FNA, is there a way to improve it?

Thank you for the repercussion here.
Unfortunately I don’t reproduce those results here. DrawString is about the same performance for me on both XNA and Monogame, but when it comes to actual images, that’s when there’s a big difference. @nkast, if you could test with images using spriteBatch.Draw() with a random rotation (because maybe sin/cos could play a role), I’d really appreciate if you could compare that scenario with 100k sprites on screen. That’s when I’m having a consistent difference of Monogame being 1/3 as fast as XNA both on my desktop with both discrete and integrated graphics, and also my notebook in both discrete and integrated too (it’s nvidia optimus, you can choose which card to use).
I really hope there’s something wrong with my setup, so if you don’t reproduce my results then we can try to figure where is the problem. Any of you are welcome to try that scenario (just 100k sprites on screen with random rotation).
Thank you very much.

Why did I suspect a hardware issue…

Can you state the model and parts you have?? it might save a lot of time…

I’m just drawing 100k sprites on screen like this:

spriteBatch.Begin(); for (int i = 0; i < amount; i++) { spriteBatch.Draw(texture, new Rectangle(random.Next(screenSize), random.Next(screenSize), spriteSize, spriteSize), textRect, Color.White, random.Next(360), Vector2.Zero, SpriteEffects.None, 1); } spriteBatch.End();

If you guys could try that snippet on your installs on both XNA and Monogame I’d really appreciate.

Same. 9fps with XNA, 29fps with MonoGame.

What project type you use? DX/OpenGL? Have you got all the drivers?
If you can, try to create a DX project. Recently I had a case where OpenGL was running in software mode after an update.

Thank you for testing it. So I’m pretty convinced something’s wrong here… I’m having about the same performance on both DX and OpenGL, and yes, I have all the latest drivers and such. I’m on Monogame 3.5.1 though, maybe that’s the problem… would you mind disclosing your environment like which Monogame and OS you’re using? What’s strange is that I’m having consistent results on different hardware and OSs… and your numbers are the opposite of mine, that’s very strange.

AMD Phenom II X-4, AMD R9 270.
Projects build with VS2010 (XNA) & VS2015 (MG/DX).

Can you create a minimum project with the problem that I test on my system?

well, looks like things are getting figured out…
I suggest we change the title of the thread to:

Great performance on windows compared to XNA and FNA, is there a way to slow it down?


1 Like

OK, I’ve made some tests and compiled various versions (XNA, FNA, MG_DX, MG_GL) and archived them in a zip file, here is the download link:

All of them share the exact same code:
public class Game1 : Microsoft.Xna.Framework.Game
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D texture;
Stopwatch sw = Stopwatch.StartNew();
Random rng = new Random();
List rates = new List(new float[30]);

    public Game1()
        graphics = new GraphicsDeviceManager(this);
        graphics.PreferredBackBufferHeight = 512;
        graphics.PreferredBackBufferWidth = 512;

    protected override void LoadContent()
        spriteBatch = new SpriteBatch(GraphicsDevice);
        texture = Texture2D.FromStream(GraphicsDevice, new System.IO.FileStream("testing.png", System.IO.FileMode.Open));

    protected override void Draw(GameTime gameTime)
        for (int i = 0; i < 100000; i++)
            spriteBatch.Draw(texture, new Vector2(rng.Next(512), rng.Next(512)), Color.White);
        rates.Add(1 / (sw.ElapsedMilliseconds / 1000f));
        float avgrate = 0;
        foreach (var item in rates)
            avgrate += item;
        avgrate /= 30;
        this.Window.Title = "FPS = " + avgrate;

And I’m having approximately those same results consistently, so if there’s a problem with my compiler maybe we could discover if you run them and the results are the same for you. The framerate shows on the window title.

Thank you very much.

@nkast Aren’t you using the latest dev branch of MG? IIRC you’ve done several optimizations to SpriteBatch since 3.5

Good to know people are working on optimization… btw, I’ve fixed the link:

I just tried the latest monogame (replaced all the dlls) and i’m having the same performance on both DX and GL, maybe even slightly worse but could just be some imprecision (within 2% difference).

@Jjagg Yes, I used latest 3.6 for the test. The majority of the changes made it into 3.5, haven’t done much since then. v3.5.1/DX from nuget gives me 29-30 frames.

@Tato I run those tests and I got

MG_DX is still x2.5 times faster that XNA.

I run my test with GL (mg3.6) and I got bad performance there too. It spend 74% of the time in PlatformDrawUserIndexedPrimitives()/IL_STUB_PInvoke. Can someone verify those numbers? Randeon settings report that I have the OpenGL installed.

@Tato Can you profile your app? Select Analyze/Performance Profiler/CPU Usage.

Results on an Intel Iris Graphics 540 are very different:

MG_DX: 33 fps
XNA: 30 fps
FNA: 50 fps
MG_GL: 52 fps

It would be interesting to compare

Wow! Something is still wrong with my OpenGL.

MG_DX: 32 fps
XNA: 30 fps
FNA: 55 fps
MG_GL: 50 fps

FNA says it’s using my integrated graphics card (Intel). Results seem very similar to what @raizam got.

An update was available for Randeon drivers (1-2 weeks from the last one).
The new numbers doesn’t look good. @tato was right from the beginning. We need to find where the bottleneck is…

MG_DX: 37 fps
XNA: 61 fps
FNA: 44 fps
MG_GL: 30 fps

@Tato Can we get the sources of those projects too?
With my own test project, now MG is @29 frames and XNA is up at XNA @25 with the new drivers, but that’s still lower than MG.

I’ve tested on my older laptop:

Intel HD Graphics Familly

MG_DX 13
xna 17
fna 4

NVidia GeForce GT 520mx

MG_DX 12 -> 5
XNA 30 -> 6
FNA 24 -> 4
MG_GL 15 -> 4

What’s strange on the NVidia is that the FPS decrease over time and stabilize on the low FPS. It’s old laptop hardware anyway.

@Tato are you on Radeon as well?

I replaced the monogame dll in the DX test with the one from PR #5267!AgIeh29TX5UhjaAonaLxzmku0SYxJQ

I saw a 7% improvement. 37fps->41fps

Installer at

Are you sure the XNA and monogame executables are using the same graphic card? If you have a laptop with two graphic cards (one integrated for windows, and a “real” one for games), sometimes the drivers will select the integrated graphic card for monogame executable.

If you have an nvidia card you can go into the nvidia control panel, add your executable to the “per program settings”, and force it to use your “real” graphic card instead of the intel one.

not sure about it but I believe it selects the best one.
In my case it was selecting the integrated intel, and when I forced it to pick the nvidia the results got worse.