UInt2048 / CyberKit

CyberKit is a backport of the open-source WebKit engine to improve the browser experience of older iOS versions.
Other
138 stars 2 forks source link

Performance: Using CyberKit/MiniBrowser causes 100-400% CPU spikes, phone heating and -1000mAh battery drain #41

Open plia7 opened 6 months ago

plia7 commented 6 months ago

Hello,

I'm using CyberKit alpha 0.0.8-alpha and MiniBrowser 0.0.9 alpha nightly 9 on my iPhone 12 Pro Max on iOS 14.4.1 with Taurine jailbreak.

Steps to reproduce: Go to a simple website link like: https://imgur.com/upload Quickly open CocoaTop64 version 2.2.3 tweak and filter by CyberKit or MiniBrowser.

This is what I see:

image

Expected behavior: Similar CPU levels like Safari browser. No battery drain, memory leak or phone heating. CPU shouldn't spike to 100-400% when using the browser, especially when not doing anything intensive in the browser.

Actual behavior: CPU levels reach 100-400% seems quite spiked all the time when using the browser. Phone temperature is heating, battery is draining much faster sometimes at -1000mAh which is a lot of draining (According to BattRate tweak version 0.0~beta2 discharge mAh indicator and battery temperature indicator (and even just by touching the phone with your hand you can tell it becomes warm after/during the browser usage)).

Workaround: None.

Additional Context: I closed all apps prior to conducting these tests so I know it's caused by the browser as without it being open everything remains at a very low baseline level.

Thank you.

plia7 commented 5 months ago

@UInt2048 Here is some insight how it can be solved:

Improving CPU and battery usage in an iOS app involves several steps:

  1. Optimize Code: Review and optimize your code to reduce unnecessary computations, loops, and memory allocations. Use efficient algorithms and data structures.

  2. Minimize Background Tasks: Limit background tasks to essential operations only. Avoid performing CPU-intensive operations when the app is in the background.

  3. Reduce Network Requests: Minimize the frequency and size of network requests. Combine multiple requests when possible and use caching to reduce redundant data transfers.

  4. Use Instruments: Utilize Xcode's Instruments tool to profile your app's performance. Identify hotspots and areas of high CPU usage, then optimize accordingly.

  5. UI Optimization: Optimize your user interface to reduce rendering and layout costs. Use techniques like cell reuse in table views and collection views.

  6. Battery Usage Profiling: Analyze battery usage patterns using Xcode's Energy Diagnostics and Battery Usage tools. Identify energy-intensive tasks and optimize them.

  7. Background Fetch: Utilize background fetch efficiently to update content only when necessary. Avoid frequent background fetches that can drain battery unnecessarily.

  8. Energy Efficiency Guidelines: Follow Apple's energy efficiency guidelines for iOS app development. Pay attention to best practices for power-efficient design and behavior.

  9. Device Testing: Test your app on various iOS devices and versions to ensure performance consistency. Different devices may exhibit different CPU and battery usage characteristics.

  10. Continuous Monitoring: Continuously monitor CPU and battery usage using tools like Xcode, Instruments, and third-party analytics services. Regularly update and optimize your app based on the insights gained from monitoring.

By implementing these strategies, you can effectively reduce CPU and battery usage in your iOS app, leading to improved performance and better user experience.

Hope this helps.

Thank you.

UInt2048 commented 5 months ago

I have the ability to type queries into ChatGPT as well loliPhoneから送信2024/03/15 6:39、plia7 @.***>のメール: @UInt2048 Here is some insight how it can be solved: Improving CPU and battery usage in an iOS app involves several steps:

Optimize Code: Review and optimize your code to reduce unnecessary computations, loops, and memory allocations. Use efficient algorithms and data structures.

Minimize Background Tasks: Limit background tasks to essential operations only. Avoid performing CPU-intensive operations when the app is in the background.

Reduce Network Requests: Minimize the frequency and size of network requests. Combine multiple requests when possible and use caching to reduce redundant data transfers.

Use Instruments: Utilize Xcode's Instruments tool to profile your app's performance. Identify hotspots and areas of high CPU usage, then optimize accordingly.

UI Optimization: Optimize your user interface to reduce rendering and layout costs. Use techniques like cell reuse in table views and collection views.

Battery Usage Profiling: Analyze battery usage patterns using Xcode's Energy Diagnostics and Battery Usage tools. Identify energy-intensive tasks and optimize them.

Background Fetch: Utilize background fetch efficiently to update content only when necessary. Avoid frequent background fetches that can drain battery unnecessarily.

Energy Efficiency Guidelines: Follow Apple's energy efficiency guidelines for iOS app development. Pay attention to best practices for power-efficient design and behavior.

Device Testing: Test your app on various iOS devices and versions to ensure performance consistency. Different devices may exhibit different CPU and battery usage characteristics.

Continuous Monitoring: Continuously monitor CPU and battery usage using tools like Xcode, Instruments, and third-party analytics services. Regularly update and optimize your app based on the insights gained from monitoring.

By implementing these strategies, you can effectively reduce CPU and battery usage in your iOS app, leading to improved performance and better user experience.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>