perf: keep ASCII LUT parsing fast alongside Unicode decoding

这个提交包含在:
mac 于 2026-11-01 15:38:52 +08:00 提交
1 父节点 8951725be2
当前提交 59b058a3c8
2 个文件已更改
+27 -6

没有与搜索条件相匹配的文件

+24 -3
查看文件
@@ -20,7 +20,7 @@
"encoding": {
"pass": true,
"checks": 179,
"mainHeartbeatMaxGapMS": 6.282333517447114,
"mainHeartbeatMaxGapMS": 6.283249938860536,
"scope": "Synthetic isolated UTF-8/16/32 LE/BE BOM/no-BOM, line endings, Unicode spacing, exact colors, corruption, async import and cancellation. No user files modified.",
"results": [
{
@@ -742,7 +742,7 @@
],
"largeEncodedBytes": 54925360,
"encodedImportFiles": 40,
"mainHeartbeatTicks": 234
"mainHeartbeatTicks": 166
},
"library": {
"checks": 112,
@@ -1039,5 +1039,26 @@
"limitations": [
"No claim of support for every historical charset or a non-Cube/binary LUT format.",
"Live FCP acceptance and final installed GPU checks remain pending."
]
],
"browser": {
"sourceBytes": 197731344,
"mainHeartbeatMaxGapMS": 6.267083343118429,
"bulkFiles": 24,
"initialLiveThumbnailViews": 45,
"snapshotsReadDuringImport": 1512,
"mainHeartbeatTicks": 1512,
"scope": "Synthetic 24 x 65-cube import with real main-run-loop heartbeat and snapshot reads; headless browser cancellation, latest selection and 3,025-entry virtualization. No user library or visible test app.",
"pass": true,
"largeCatalogEntries": 3025,
"cubeDimension": 65,
"initialLiveFolderViews": 15,
"importSeconds": 7.526092541636899,
"checks": 67
},
"discardedPreOptimizationSubmission": {
"id": "f9bfc2f2-e69d-4589-ae93-e9ce943ea44f",
"compiledSource": "8951725be233eff73627464fd78315b358d8fae4",
"installed": false,
"reason": "Replaced before installation by an optimized ASCII whitespace fast path. The next submission contains changed code, not a duplicate upload of the same artifact."
}
}
+3 -3
查看文件
@@ -140,9 +140,9 @@ static BOOL DYLUTText(NSData *bytes,std::string& text,NSProgress *progress,NSErr
static std::string_view DYLUTTrim(std::string_view v) {
while(!v.empty()) {
unsigned char c=v.front();size_t count=0;
if(c==' '||(c>=9&&c<=13))count=1;
else if(v.size()>=2&&v.substr(0,2)=="\xc2\xa0")count=2;
else if(v.size()>=3&&(v.substr(0,3)=="\xe1\x9a\x80"||v.substr(0,3)=="\xe2\x80\xaf"||v.substr(0,3)=="\xe2\x81\x9f"||v.substr(0,3)=="\xe3\x80\x80"||(v.substr(0,2)=="\xe2\x80"&&(unsigned char)v[2]>=0x80&&(unsigned char)v[2]<=0x8a)))count=3;
if(c<0x80){if(c==' '||(c>=9&&c<=13))count=1;else break;}
else if(c==0xc2&&v.size()>=2&&v[1]=='\xa0')count=2;
else if((c==0xe1||c==0xe2||c==0xe3)&&v.size()>=3&&(v.substr(0,3)=="\xe1\x9a\x80"||v.substr(0,3)=="\xe2\x80\xaf"||v.substr(0,3)=="\xe2\x81\x9f"||v.substr(0,3)=="\xe3\x80\x80"||(v.substr(0,2)=="\xe2\x80"&&(unsigned char)v[2]>=0x80&&(unsigned char)v[2]<=0x8a)))count=3;
if(!count)break;v.remove_prefix(count);
}return v;
}