CPU Utilization in LineChartRenderer.swift
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
## What did you do?
Updated to Swift 4.2 compliant version of Charts.
## What did you expect to happen?
Swift 4.2 compliance
## What happened instead?
Everything went smoothly, except that the CPU utilization increased significantly from ~33% to ~90% while presenting a continuously updated line chart 15 times a second resulting in choppy visual performance.
However, I was able to find in **LineChartRenderer.swift** on line 632 one of the changes from the previous version was the removal of the OR test for `!dataSet.isDrawCirclesEnabled `for a continue statement. Which means even though the circles are not drawn, the process still falls through the continue statement executing the code. When I replaced the OR test the CPU utilization returned to where it was previously.
I returned this:
```
if !dataSet.isVisible || dataSet.entryCount == 0
{
continue
}
```
Back to this:
```
if !dataSet.isVisible || !dataSet.isDrawCirclesEnabled || dataSet.entryCount == 0
{
continue
}
```
to regain the performance.
Thanks.
Stoodwalk
## Charts Environment
**Charts 3.2.1/ **Version 3.2.1**, synced to [MPAndroidChart #f6a398b]
**Xcode version: 10.1
**Swift version: 4.2
**Platform(s) running Charts: iOS
**macOS version running Xcode: 10.13.6
Contributor guide
Assessment
This issue has not been assessed yet.