forked from External/mage
performance: improved CPU usage in games with big amount of permanents (related to #11285)
This commit is contained in:
parent
1f50f95f8b
commit
70c79fd6a6
4 changed files with 14 additions and 5 deletions
|
|
@ -24,11 +24,16 @@ public class AbilitiesImpl<T extends Ability> extends ArrayList<T> implements Ab
|
|||
|
||||
private static final ThreadLocalStringBuilder threadLocalBuilder = new ThreadLocalStringBuilder(200);
|
||||
|
||||
public AbilitiesImpl() {
|
||||
// fast constructor
|
||||
}
|
||||
|
||||
public AbilitiesImpl(T... abilities) {
|
||||
Collections.addAll(this, abilities);
|
||||
}
|
||||
|
||||
public AbilitiesImpl(final AbilitiesImpl<T> abilities) {
|
||||
this.ensureCapacity(abilities.size());
|
||||
for (T ability : abilities) {
|
||||
this.add((T) ability.copy());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public abstract class CostImpl implements Cost {
|
|||
protected UUID id;
|
||||
protected String text;
|
||||
protected boolean paid;
|
||||
protected Targets targets;
|
||||
protected Targets targets; // TODO: optimize performance - use private and null by default
|
||||
|
||||
public CostImpl() {
|
||||
id = UUID.randomUUID();
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
|
|||
private ManaCostsImpl(final ManaCostsImpl<T> costs) {
|
||||
this.id = costs.id;
|
||||
this.text = costs.text;
|
||||
this.ensureCapacity(costs.size());
|
||||
for (T cost : costs) {
|
||||
this.add(cost.copy());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue