Commit 87ad657
node-api: implement external strings
Introduce APIs that allow for the creation of JavaScript strings without
copying the underlying native string into the engine. The APIs fall back
to regular string creation if the engine's external string APIs are
unavailable. In this case, an optional boolean out-parameter indicates
that the string was copied, and the optional finalizer is called if
given.
PR-URL: #48339
Fixes: #48198
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Signed-off-by: Gabriel Schulhof <gabrielschulhof@gmail.com>1 parent 0500967 commit 87ad657Copy full SHA for 87ad657
File tree
Expand file treeCollapse file tree
11 files changed
+713
-176
lines changedOpen diff view settings
Filter options
- benchmark/napi/string
- doc/api
- src
- test
- js-native-api
- test_string
- node-api/test_reference_by_node_api_version
Expand file treeCollapse file tree
11 files changed
+713
-176
lines changedOpen diff view settings
Collapse file
benchmark/napi/string/.gitignore
Copy file name to clipboard+1Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
Collapse file
benchmark/napi/string/binding.c
Copy file name to clipboard+56Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
Collapse file
benchmark/napi/string/binding.gyp
Copy file name to clipboard+8Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
Collapse file
benchmark/napi/string/index.js
Copy file name to clipboard+19Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
Collapse file
+108-1Lines changed: 108 additions & 1 deletion
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
801 | 801 | |
802 | 802 | |
803 | 803 | |
804 | | - |
| 804 | + |
805 | 805 | |
806 | 806 | |
807 | 807 | |
| ||
819 | 819 | |
820 | 820 | |
821 | 821 | |
| 822 | + |
| 823 | + |
| 824 | + |
| 825 | + |
| 826 | + |
822 | 827 | |
823 | 828 | |
824 | 829 | |
| ||
2886 | 2891 | |
2887 | 2892 | |
2888 | 2893 | |
| 2894 | + |
| 2895 | + |
| 2896 | + |
| 2897 | + |
| 2898 | + |
| 2899 | + |
| 2900 | + |
| 2901 | + |
| 2902 | + |
| 2903 | + |
| 2904 | + |
| 2905 | + |
| 2906 | + |
| 2907 | + |
| 2908 | + |
| 2909 | + |
| 2910 | + |
| 2911 | + |
| 2912 | + |
| 2913 | + |
| 2914 | + |
| 2915 | + |
| 2916 | + |
| 2917 | + |
| 2918 | + |
| 2919 | + |
| 2920 | + |
| 2921 | + |
| 2922 | + |
| 2923 | + |
| 2924 | + |
| 2925 | + |
| 2926 | + |
| 2927 | + |
| 2928 | + |
| 2929 | + |
| 2930 | + |
| 2931 | + |
| 2932 | + |
| 2933 | + |
| 2934 | + |
| 2935 | + |
| 2936 | + |
| 2937 | + |
| 2938 | + |
| 2939 | + |
| 2940 | + |
| 2941 | + |
| 2942 | + |
| 2943 | + |
2889 | 2944 | |
2890 | 2945 | |
2891 | 2946 | |
| ||
2914 | 2969 | |
2915 | 2970 | |
2916 | 2971 | |
| 2972 | + |
| 2973 | + |
| 2974 | + |
| 2975 | + |
| 2976 | + |
| 2977 | + |
| 2978 | + |
| 2979 | + |
| 2980 | + |
| 2981 | + |
| 2982 | + |
| 2983 | + |
| 2984 | + |
| 2985 | + |
| 2986 | + |
| 2987 | + |
| 2988 | + |
| 2989 | + |
| 2990 | + |
| 2991 | + |
| 2992 | + |
| 2993 | + |
| 2994 | + |
| 2995 | + |
| 2996 | + |
| 2997 | + |
| 2998 | + |
| 2999 | + |
| 3000 | + |
| 3001 | + |
| 3002 | + |
| 3003 | + |
| 3004 | + |
| 3005 | + |
| 3006 | + |
| 3007 | + |
| 3008 | + |
| 3009 | + |
| 3010 | + |
| 3011 | + |
| 3012 | + |
| 3013 | + |
| 3014 | + |
| 3015 | + |
| 3016 | + |
| 3017 | + |
| 3018 | + |
| 3019 | + |
| 3020 | + |
| 3021 | + |
2917 | 3022 | |
2918 | 3023 | |
2919 | 3024 | |
| ||
6476 | 6581 | |
6477 | 6582 | |
6478 | 6583 | |
| 6584 | + |
| 6585 | + |
6479 | 6586 | |
6480 | 6587 | |
6481 | 6588 | |
|
Collapse file
+18Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
92 | 92 | |
93 | 93 | |
94 | 94 | |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
95 | 113 | |
96 | 114 | |
97 | 115 | |
|
0 commit comments