-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply the mask on the image, not tile, convert the image to pixmap, not ... #577
Conversation
…ot the tile, greate performance improvement
Here it's about 3x of performance on this function |
Ah, sorry I hadn't noticed you had already done measurements when commenting on issue #576. What operating system are you using? I'll try it as well. |
I've measured the difference on Linux with both Qt 4.8 and 5.2 and with your patch I'm experiencing it to be 15% slower. This basically confirms my suspicion that there should be an additional overhead to this approach as noted at issue #576. If you really measured a 3x speedup, please tell me on which operating system and if you can provide me with the files you're using to test it. Closing this issue for now. |
I use Linux gentoo, gcc 4.7, with kernel 3.10.25, Qt 5.2. It's very strange, because my patch reduce the number of call, and is better because apply on large image, then can be scalled better. |
The number of calls is not very important, what matters is the time the code takes to execute. Also, maybe you need to read again what I pointed out at #576. I'm sure applying the mask to the big image could be a little faster than applying the mask separately to each tile, however using |
The number of calls is important because it imply allocation/desallocation of temporary variable/buffer, and then time. If you see why we have this difference... |
Your callgrind analysis shows that your tilesets are apparently using indexed 8-bit color and both variants of the code are spending most of time converting from indexed 8-bit format to 32-bit color format. It wouldn't be very surprising when this conversion was a little faster when performed on the whole image instead of on each tile separately as the existing code does, so I think that's the reason why you're seeing your code being a little bit faster. That said, the speed difference seems minimal to me and in the more common case of 32-bit images I measured that it became slower, so I still think it's better to just let the code as it is. |
I use optimized tilset size by pngquant, then yes, indexed. When I use only the function is very more faster. |
Extracted from: https://bugreports.qt-project.org/browse/QTBUG-36031 |
The temporary conversion to QImage and back is indeed very fast, but it is still better avoided when this is trivially possible. Why is this issue so important to you that you would go and ask the Qt developers to optimize this method? Even by your own measurements your application is only about 10% faster with your changes... |
Because it's key method for render the large map (like google map), and on my datapack explorer: |
Then I have add into in my tiled version: |
...the tile, greate performance improvement