优化打包速度,提示编辑器启动速度,md5替换xxhash,速度提升一倍以上

This commit is contained in:
yingnierxiao
2023-08-25 14:53:59 +08:00
parent a618b6cf9e
commit 064e9a1aa3
45 changed files with 3172 additions and 21 deletions

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Security.Cryptography;
using Standart.Hash.xxHash;
namespace YooAsset
{
@@ -280,6 +281,28 @@ namespace YooAsset
return string.Empty;
}
}
/// <summary>
/// 获取文件的XXXhash32
/// </summary>
/// <param name="filePath"></param>
/// <returns></returns>
public static string FileXXhash(string filePath)
{
try
{
using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
return xxHash32.ComputeHash(fs).ToString("x8");
}
}
catch (Exception e)
{
YooLogger.Exception(e);
return string.Empty;
}
}
/// <summary>
/// 获取数据流的MD5