Skip to content

Commit 5a18d0e

Browse files
Eliminate allocs - Adjust pool replenishing (PhilJay#1892)
Replenish fewer objects in utils pools when empty, in case the pool size grows large.
1 parent b037f55 commit 5a18d0e

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

MPChartLib/src/main/java/com/github/mikephil/charting/utils/FSize.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public final class FSize extends ObjectPool.Poolable{
1818

1919
static {
2020
pool = ObjectPool.create(256, new FSize(0,0));
21+
pool.setReplenishPercentage(0.5f);
2122
}
2223

2324

MPChartLib/src/main/java/com/github/mikephil/charting/utils/MPPointF.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ public class MPPointF extends ObjectPool.Poolable {
1616

1717
static {
1818
pool = ObjectPool.create(32, new MPPointF(0,0));
19+
pool.setReplenishPercentage(0.5f);
1920
}
2021

2122
private MPPointF(float x, float y){

MPChartLib/src/main/java/com/github/mikephil/charting/utils/PointD.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class PointD extends ObjectPool.Poolable {
1414

1515
static {
1616
pool = ObjectPool.create(64, new PointD(0,0));
17+
pool.setReplenishPercentage(0.5f);
1718
}
1819

1920
public static PointD getInstance(double x, double y){

0 commit comments

Comments
 (0)