فهرست منبع

[neko] Optimise BytesBuffer length field (#11090)

If the __get_length method is available, there is no need to allocate
a new string.
tobil4sk 2 سال پیش
والد
کامیت
e3a9b91387
1فایلهای تغییر یافته به همراه2 افزوده شده و 0 حذف شده
  1. 2 0
      std/haxe/io/BytesBuffer.hx

+ 2 - 0
std/haxe/io/BytesBuffer.hx

@@ -63,6 +63,8 @@ class BytesBuffer {
 
 	inline function get_length():Int {
 		#if neko
+		if (@:privateAccess StringBuf.__get_length != null)
+			return untyped StringBuf.__get_length(b);
 		return untyped __dollar__ssize(StringBuf.__to_string(b));
 		#elseif cs
 		return haxe.Int64.toInt(b.Length);