I asked about it on forum but nobody answered so had to make my own test.
And I'm very surprised. But maybe there is bug somewhere.
sdk 4.1.0 Beta 1 (there is profiler)
eclipse CIQ plug in: 4.1.0.beta2
eclipse Version: 2021-12 (4.22.0) Build id: 20211202-1639
windows 10
watch face
minSdkVersion 2.4.0
class Test { ... var mPcX, mPcY, mIconClipX, mIconClipY, mIconClipW, mIconClipH; static var mIconBuf; ... function initialize(def) { ... if(mIconBuf == null) { if(GRA has :createBufferedBitmap) { mIconBuf = GRA.createBufferedBitmap ( { :width => mIconClipW, :height => mIconClipH } ); mIconBuf = mIconBuf.get(); }else { mIconBuf = new GRA.BufferedBitmap ( { :width => mIconClipW, :height => mIconClipH } ); } } ... } function drawRectDirect(dc) { dc.fillRectangle(mIconClipX, mIconClipY, mIconClipW, mIconClipH); } function drawRectBuffer(dc) { dc.drawBitmap(mIconClipX, mIconClipY, mIconBuf); } function drawTxtBackground(dc) { dc.setColor(0xFFFFFF, 0x000000); dc.drawText(mPcX, mPcY, gFn, "TEST", 5); } function drawTxtTransparent(dc) { dc.setColor(0xFFFFFF, -1); dc.drawText(mPcX, mPcY, gFn, "TEST", 5); } function draw(dc) { ... // order nothing change I clear all screen before draw and tested with oposite order too drawTxtTransparent(dc); drawTxtBackground(dc); drawRectBuffer(dc); drawRectDirect(dc); } }
Results:
total time | actual time | call count | total/count |
buffered/direct transparent/background |
|
fenix6pro | |||||
drawRectBuffer | 3960 | 1378 | 160 | 24,75 | 63,10% |
drawRectDirect | 2428 | 1425 | 160 | 15,18 | |
drawTxtTransparent | 6600 | 2179 | 130 | 50,77 | -7,36% |
drawTxtBackground | 7124 | 2223 | 130 | 54,80 | |
fenix7 - with GPU | |||||
drawRectBuffer | 19189 | 1282 | 160 | 119,93 | 140,49% |
drawRectDirect | 7979 | 1417 | 160 | 49,87 | |
drawTxtTransparent | 41731 | 2189 | 130 | 321,01 | 10,90% |
drawTxtBackground | 37628 | 2262 | 130 | 289,45 |
Conclusions:
- f7 with GPU is dramatically slower than f6pro even 7 times slower
- always drawing from buffer is slower than direct draw (the same effect) on f7 almost 3x longer but should be much faster (e.g. no counting pixel from lines/rectangles)
- background colour has meaning for text's drawing time (for me transparent should be faster - less pixels to draw, checking the same but of course everything depends on what is faster drawing on screen or calculating pixels) text with transparent transparent is slower on f7 (should be
Conclusions:
- never use buffered bitmpaps
- draw text with different background colour on different devices
- or there is bug in profiler/sim and on device it's look quite opposite - but it's very difficult to count this on device