Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppress blendshape gabage collection #330

Merged
merged 4 commits into from Dec 12, 2019

Conversation

Kohei-Yanagida
Copy link
Collaborator

BlendShapeKeyクラスで頻繁に発生していたGCを低減
string.ToUpper() , Enum.ToString() を呼び出す頻度が少なくなるように修正

この変更により一部挙動が以下のように変わります。

  • BlendShapeKeyのNameがBlink のような定義済みPresetと同名であれば、Preset=BlendShapePreset.BlinkのBlendShapeKeyと同一と見なせていたものが別扱いになる

  • NameがToUpper()によって大文字と小文字の区別がされていなかったものが区別されるようになる

Copy link
Contributor

@ousttrue ousttrue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public bool Equals(BlendShapeKey other)
{
    if(BlendShapePreset !=other.BlendShapePreset )
    {
        // Presetが違うときはfalse
        return false;
    }
    if(BlendShapePreset==BlendShapePreset.Unknown)
    {
       // unknown のときだけ名前比較する
       if(m_name.!=other.m_name)
       {
           return false;
       }
    }

    return true;
}

のキャッシュ付きという感じでしょうか。
我ながら分かりにくいコードだ・・・
訂正しました。

preset name 判定
同(unknown以外) 比較しない
同(unknown) 比較 nameの比較
比較しない

@ousttrue ousttrue merged commit 03f96bd into vrm-c:master Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants