I have a method that is called each frame that will object a GUI window based on the selected object's properties.

private void Update_Window_Properties()
        {
            if (objectSelected == null)
            {
                return;
            }

            Entity e = objectSelected.Entity;

            Vector3 position = e.InternalCenterPosition;
            textBox_PositionX.Text = position.X.ToString();
            textBox_PositionY.Text = position.Y.ToString();
            textBox_PositionZ.Text = position.Z.ToString();

            Vector3 rotation = e.InternalOrientationMatrix.ToEulerAngles();
            textBox_RotationX.Text = rotation.X.ToString();
            textBox_RotationY.Text = rotation.Y.ToString();
            textBox_RotationZ.Text = rotation.Z.ToString();

            Vector3 scale = objectSelected.Scale;
            textBox_ScaleX.Text = scale.X.ToString();
            textBox_ScaleY.Text = scale.Y.ToString();
            textBox_ScaleZ.Text = scale.Z.ToString();

            if (comboBox_ShapeType.ItemIndex != (int)objectSelected.Shape)
            {
                comboBox_ShapeType.ItemIndex = (int)objectSelected.Shape;
            }

            textBox_Mass.Text = e.Mass.ToString();

            Vector3 angularVelocity = e.InternalAngularVelocity;
            textBox_AngularVelocityX.Text = angularVelocity.X.ToString();
            textBox_AngularVelocityY.Text = angularVelocity.Y.ToString();
            textBox_AngularVelocityZ.Text = angularVelocity.Z.ToString();

            Vector3 linearVelocity = e.InternalLinearVelocity;
            textBox_LinearVelocityX.Text = linearVelocity.X.ToString();
            textBox_LinearVelocityY.Text = linearVelocity.Y.ToString();
            textBox_LinearVelocityZ.Text = linearVelocity.Z.ToString();

            imageBox_Texture.Image = game.Textures[objectSelected.TextureIndex];
        }

My FPS will drop from 817 to 100 if this method is run once per frame. How can I possibly reduce the damage from this horrible bottleneck?

You can try removing all the object creation you are doing (the Vector3 ... lines) and just use the properties directly (except for the EulerAngle).

I'd also remove all the calls to ToString() and let the system do the conversion itself. Probably won't make a difference, but who knows what the optimizer will do :)

None of the those methods made a difference unfortunately. :(

I'd also remove all the calls to ToString() and let the system do the conversion itself

The can't be done as it will not automatically cast from float to String.

Any other suggestions? This really is a pain in the bum!

This article has been dead for over six months. Start a new discussion instead.