Commit cd99819e authored by Nikolay Igotti's avatar Nikolay Igotti

Cleaner locks.

parent 64946688
...@@ -60,23 +60,22 @@ internal class MetalRedrawer( ...@@ -60,23 +60,22 @@ internal class MetalRedrawer(
private suspend fun draw() { private suspend fun draw() {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
val handle = startRendering() val handle = startRendering()
if (layer.prepareDrawContext()) { synchronized(disposeLock) {
// 2,3 GHz 8-Core Intel Core i9 if (!isDisposed)
// if (layer.prepareDrawContext()) {
// Test1. 8 windows, multiple clocks, 800x600 // 2,3 GHz 8-Core Intel Core i9
// //
// Executors.newSingleThreadExecutor().asCoroutineDispatcher(): 20 FPS, 130% CPU // Test1. 8 windows, multiple clocks, 800x600
// Dispatchers.IO: 58 FPS, 460% CPU //
// // Executors.newSingleThreadExecutor().asCoroutineDispatcher(): 20 FPS, 130% CPU
// Test2. 60 windows, single clock, 800x600 // Dispatchers.IO: 58 FPS, 460% CPU
// //
// Executors.newSingleThreadExecutor().asCoroutineDispatcher(): 50 FPS, 150% CPU // Test2. 60 windows, single clock, 800x600
// Dispatchers.IO: 50 FPS, 200% CPU //
synchronized(disposeLock) { // Executors.newSingleThreadExecutor().asCoroutineDispatcher(): 50 FPS, 150% CPU
if (!isDisposed) { // Dispatchers.IO: 50 FPS, 200% CPU
layer.draw() layer.draw()
} }
}
} }
endRendering(handle) endRendering(handle)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment