# Do dynamic classes affect performance?

**URL:** <https://forum.kirupa.com/t/do-dynamic-classes-affect-performance/303602>\
**Category:** flash\
**Created:** [January 23, 2010, 1:46am UTC](https://forum.kirupa.com/t/do-dynamic-classes-affect-performance/303602 "2010-01-23T01:46:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IQAndreas](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@IQAndreas](https://forum.kirupa.com/u/IQAndreas)\
**Post date:** [January 23, 2010, 1:46am UTC](https://forum.kirupa.com/t/do-dynamic-classes-affect-performance/303602/1 "2010-01-23T01:46:25Z")

</div>

From what I hear, getting/setting dynamic properties is a lot slower than regular properties.

**But does allowing a class to be dynamic slow down the entire class for regular property getting/setting?**

For instance, let’s say I have this class (pretend those properties have setters as well):

```auto
public dynamic class Hero
{
   public function get endurance():int
   { return _endurance; }

   public function get strength():int
   { return _strength; }

   public function hit(target:Enemy)
   { target.damage(this.strength); }
}

```

Since the class is dynamic, properties can be added on later, such as:  
_hero1[“magic”] = 500;_ or _hero1.magic = 500;_

Obviously, calling and setting the “magic” property will be a lot slower, but **will all properties become slower to get/set just because the entire class is set to dynamic?**

**Is it better to not set the entire class to dynamic, and instead create a new dynamic object, “additionalStats” where properties can be get/set to instead?**
