以下の内容はhttps://baba-s.hatenablog.com/entry/2025/10/20/151208より取得しました。


【C#】.Replace( "\\", "/" ) よりも .Replace( '\\', '/' ) の方が速い

検証結果

検証用スクリプト

using UnityEngine;
using UnityEngine.Profiling;

public class Example : MonoBehaviour
{
    private void Update()
    {
        const string path  = "Assets\\material.mat";
        const int    count = 100000;

        Profiler.BeginSample( "\"" );

        for ( var i = 0; i < count; i++ )
        {
            _ = path.Replace( "\\", "/" );
        }

        Profiler.EndSample();

        Profiler.BeginSample( "\'" );

        for ( var i = 0; i < count; i++ )
        {
            _ = path.Replace( '\\', '/' );
        }

        Profiler.EndSample();
    }
}



以上の内容はhttps://baba-s.hatenablog.com/entry/2025/10/20/151208より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14