mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
node-api: optimize napi_set_property for perf
PR-URL: https://github.com/nodejs/node/pull/50282 Reviewed-By: Vladimir Morozov <vmorozov@microsoft.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
parent
41df25249b
commit
59e7444766
5 changed files with 97 additions and 0 deletions
|
@ -16,6 +16,8 @@ assert.strictEqual(test_string.TestLatin1External(empty), empty);
|
|||
assert.strictEqual(test_string.TestUtf16External(empty), empty);
|
||||
assert.strictEqual(test_string.TestLatin1ExternalAutoLength(empty), empty);
|
||||
assert.strictEqual(test_string.TestUtf16ExternalAutoLength(empty), empty);
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16(empty), empty);
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16AutoLength(empty), empty);
|
||||
assert.strictEqual(test_string.Utf16Length(empty), 0);
|
||||
assert.strictEqual(test_string.Utf8Length(empty), 0);
|
||||
|
||||
|
@ -33,6 +35,8 @@ assert.strictEqual(test_string.TestUtf16ExternalAutoLength(str1), str1);
|
|||
assert.strictEqual(test_string.TestLatin1Insufficient(str1), str1.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestUtf8Insufficient(str1), str1.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestUtf16Insufficient(str1), str1.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16(str1), str1);
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16AutoLength(str1), str1);
|
||||
assert.strictEqual(test_string.Utf16Length(str1), 11);
|
||||
assert.strictEqual(test_string.Utf8Length(str1), 11);
|
||||
|
||||
|
@ -50,6 +54,8 @@ assert.strictEqual(test_string.TestUtf16ExternalAutoLength(str2), str2);
|
|||
assert.strictEqual(test_string.TestLatin1Insufficient(str2), str2.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestUtf8Insufficient(str2), str2.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestUtf16Insufficient(str2), str2.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16(str2), str2);
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16AutoLength(str2), str2);
|
||||
assert.strictEqual(test_string.Utf16Length(str2), 62);
|
||||
assert.strictEqual(test_string.Utf8Length(str2), 62);
|
||||
|
||||
|
@ -67,6 +73,8 @@ assert.strictEqual(test_string.TestUtf16ExternalAutoLength(str3), str3);
|
|||
assert.strictEqual(test_string.TestLatin1Insufficient(str3), str3.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestUtf8Insufficient(str3), str3.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestUtf16Insufficient(str3), str3.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16(str3), str3);
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16AutoLength(str3), str3);
|
||||
assert.strictEqual(test_string.Utf16Length(str3), 27);
|
||||
assert.strictEqual(test_string.Utf8Length(str3), 27);
|
||||
|
||||
|
@ -84,6 +92,8 @@ assert.strictEqual(test_string.TestUtf16ExternalAutoLength(str4), str4);
|
|||
assert.strictEqual(test_string.TestLatin1Insufficient(str4), str4.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestUtf8Insufficient(str4), str4.slice(0, 1));
|
||||
assert.strictEqual(test_string.TestUtf16Insufficient(str4), str4.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16(str4), str4);
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16AutoLength(str4), str4);
|
||||
assert.strictEqual(test_string.Utf16Length(str4), 31);
|
||||
assert.strictEqual(test_string.Utf8Length(str4), 62);
|
||||
|
||||
|
@ -101,6 +111,8 @@ assert.strictEqual(test_string.TestUtf16ExternalAutoLength(str5), str5);
|
|||
assert.strictEqual(test_string.TestLatin1Insufficient(str5), str5.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestUtf8Insufficient(str5), str5.slice(0, 1));
|
||||
assert.strictEqual(test_string.TestUtf16Insufficient(str5), str5.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16(str5), str5);
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16AutoLength(str5), str5);
|
||||
assert.strictEqual(test_string.Utf16Length(str5), 63);
|
||||
assert.strictEqual(test_string.Utf8Length(str5), 126);
|
||||
|
||||
|
@ -113,6 +125,8 @@ assert.strictEqual(test_string.TestUtf16External(str6), str6);
|
|||
assert.strictEqual(test_string.TestUtf16ExternalAutoLength(str6), str6);
|
||||
assert.strictEqual(test_string.TestUtf8Insufficient(str6), str6.slice(0, 1));
|
||||
assert.strictEqual(test_string.TestUtf16Insufficient(str6), str6.slice(0, 3));
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16(str6), str6);
|
||||
assert.strictEqual(test_string.TestPropertyKeyUtf16AutoLength(str6), str6);
|
||||
assert.strictEqual(test_string.Utf16Length(str6), 5);
|
||||
assert.strictEqual(test_string.Utf8Length(str6), 14);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue