SecUSo / privacy-friendly-sudoku

Privacy Friendly App to play Sudoku on Android.
https://secuso.org/pfa-sudoku
GNU General Public License v3.0
147 stars 56 forks source link

High Power Drain #8

Closed BoBeR182 closed 4 years ago

BoBeR182 commented 8 years ago

Sudoku used 7% of my battery in 3 minutes.

Sony Xperia Z1 Kitkat 4.4.4

Yonjuni commented 8 years ago

Thanks for the comment. On the first launch it requires a bit more battery because the level generator generates levels in the background.

petermayer commented 8 years ago

Why are the levels not generated on demand?

Kamuno commented 8 years ago

5 Levels are pregenerated, because generating a level with a certain difficulty can take a while on older devices. Especially for the 12x12 Sudokus it can take up to 30 seconds (on my device) to generate a Sudoku with a desired difficulty, which is just way too long to wait for, when you want to play right now.

We could add more preset levels, so the app will not generate any puzzles at all, when installing the app for the first time. We thought it would be better to have only a few preset and some generated so not everybody would see the same sudokus the first time they open up the app.

But apparently it causes confusion about the power consumption being too high.. so we will change that.

BoBeR182 commented 8 years ago

A loading bar, or warning about generation would be nice, I do not need 5 levels of each setting 3x3x5 (45 Levels) ready to go. I rather wait 30 seconds with a warning or loading bar, than have my battery drop so drastically. If you really need generation, maybe allow the first puzzle to be pregenerated, and only generate one puzzle in reserves, I do not see a user completing a puzzle in under 30 seconds.

Kamuno commented 8 years ago

I will change it, so every level will be pregenerated and none have to be generated on the first start of the App. New levels will then only be generated to restock, when a level is being loaded. In most cases this will be 1 at a time and wont use a lot of battery.

A text informing you, that new levels are being generated, is already being displayed when you try to load a new level, when there are none stored. We had it set to 1 puzzle in reserve, but during testing we found some people starting new Sudokus back to back, without completing the ones they were starting, because they didn't like it.

Kamuno commented 8 years ago

Implemented the change. Will go live with the next update.

anarcat commented 7 years ago

i don't know why, but i have also found that sudoku has a huge power drain. i have played 2-3 games last night, for a total playing time of 1h, and completely drained my battery from 60% to zero.

i don't know if it was generating games or what, but i would have expected it to use less battery.

i wonder if it's not just the backlight that was taking up all the battery. maybe some battery savings could be had with a AMOLED theme, where the background would be black instead of white, to save battery?

Yonjuni commented 7 years ago

Which version of Sudoku have you installed currently?

anarcat commented 7 years ago

2.0.1 installed from f-droid yesterday.

Yonjuni commented 7 years ago

Thanks, this problem will be addressed in the next version. It is due to the level generator which will be updated soon.

m-rtijn commented 7 years ago

I see that this is an old issue, which I'm still experiencing. I run version 2.1.1 (from F-Droid) and Android (6.0.1 on my Motorola Moto X Play) reports 46 minutes of foreground CPU usage with 195mAh computer power use. Is this still due to level generator?

Yonjuni commented 7 years ago

@Tijndagamer Do you see a notification that the app is generating levels?

m-rtijn commented 7 years ago

No, I did not.

Yonjuni commented 7 years ago

Okay, then it's not the level generator.

hashar commented 6 years ago

38 is similar, CPU usage / battery drain while playing.

hashar commented 6 years ago

I ran the application in Android Studio which has a CPU profiler. I created a new board and ran the profiler. It seems the application keeps redrawing cells over and over.

android.os.Looper.loop keeps dispatching messages which are handled by android.view.Choreographer$FrameDisplayEventReceiver.run which eventually trigger org.secuso.privacyfriendlysudoku.ui.view.SudokuFieldLayout.dispatchDraw.

What I suspect is once the cell/value/background have been draw, that emits a message to the ChoreoGrapher. It then dispatch the message which is handled by the app and rewraw cells again. And hence there is an infinite loop.