且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

没有使用gcc进行小的字符串优化?

更新时间:2023-12-03 11:56:40

您的标志之一是:

--with-default-libstdcxx-abi=gcc4-compatible

GCC4不支持小字符串优化.

and GCC4 does not support small string optimzation.

GCC5开始支持它. isocpp 指出:

GCC5 started supporting it. isocpp states:

默认情况下,使用小字符串优化而不是写时复制引用计数来启用std :: string的新实现.

A new implementation of std::string is enabled by default, using the small string optimization instead of copy-on-write reference counting.

支持我的主张.

此外,浏览std :: string 时提到:

如我们所见,较旧的libstdc ++实现了写时复制功能,因此它使 他们没有利用小对象优化的感觉.

As we see, older libstdc++ implements copy-on-write, and so it makes sense for them to not utilize small objects optimization.

然后当GCC5出现时,他更改上下文.

and then he changes context, when GCC5 comes in play.