[SCRIPT] REWRITE Benny's Motorworks SP Mod into a ASI performence increased script
Alot of people having these problems, but not all people. Can you show me how many FPS you have without NativeUI and once it running with menu open?
@MrGTAmodsgerman Well, it seems I was mistaken. I always have VSync on and had never noticed a problem, having just switched it off, the problem is very clear. Just to be clear, I had no other scripts running other than this one at this time. Also, this is lower than it was during the day, it was a 30fps drop during daytime, I just used night because it was easier to see the numbers.
I mean, just to put this into perspective, my Helicopter Effects mod was causing a 9 - 10 fps drop and that was collecting a large number of vehicles over a wide area... before I optimised it that is.
23fps is a 25% performance hit I am going to do a test mod that draws some rectangles and text using the native functions directly, to see what kind of performance impact they have.
Well it looks like Rectangles have pretty much zero impact on performance. Here's an image of 130 alpha blended rectangles on screen and the FPS was exactly the same as when there were none.
These are drawn with
Function.Call(Hash.DRAW_RECT, _drawRect.X, _drawRect.Y, _drawRect.Width, _drawRect.Height, 0, 0, 0, 192);and not NativeUI Rectangles.
However, this is a prime example of where NativeUI is doing something really bad. Every time it draws a rectangle (using the same Native call), it gets the screen width and height and calculates the aspect ratio, the rectangle width, height, X and Y position.
Why on earth would you do all that in the draw function? That should be done in the update function but only if the screen resolution changes. Things that don't change every frame, shouldn't be re-calculated every frame.
@LeeC2202 Yea, so Guadmaz should know what that is happend. And btw, which graphic card do you have?
@MrGTAmodsgerman I have a 1080, running with an i7 980 Heptacore CPU.
@LeeC2202 1080!! i7, 7 CORES!!! LUCKY!!!!
@NotCrunchyTaco Oops, I think that should be Hexacore... it's a 6-core CPU. I didn't feel lucky when I had to hand over the cash, it was about £450 when I got it.
LOL, I've actually managed to get it to give me a 50fps drop. So that was 117 down to 65.
The bigger the menu, the bigger the frame rate hit it seems.
Now I am starting to look into this, I am starting to realise the scale of the problem. This is a single UIMenuItem on a single menu.
I was planning on creating menus that have the different menu item types (CheckBox & List), to see if there was any difference but if it is getting this level of performance drain with the most basic of items, I don't think I need to do anything more.
Considering all of my mods together only result in a fraction of this kind of drop, it makes it hard to even contemplate how you can manage to achieve this. With my rectangle test, it actually got to 300 before I saw an FPS drop of just 3, so there is no way that is contributing to this.
Which leaves me with two dilemmas...
- Am I disturbed by this enough to take on the task of writing a menu system of my own?
- Am I capable of writing a menu system of my own?
And I can only answer Yes and Maybe to those... but this is bad enough for me to maybe give it a shot. The worst that can happen is that I can fail miserably.
Ignore the banding on the image, it's because I saved it as a 32 colour indexed PNG to keep the file size down.
Well, NativeUI is the problem. I would be glad to see someone create another library or at least fix it unofficially.