No small string optimization with gcc?

后端 未结 1 919
余生分开走
余生分开走 2021-02-12 19:03

Most std::string implementations (GCC included) use small string optimization. E.g. there\'s an answer discussing this.

Today, I decided to check at what po

相关标签:
1条回答
  • 2021-02-12 19:43

    One of your flags is:

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

    and GCC4 does not support small string optimzation.


    GCC5 started supporting it. isocpp states:

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

    which supports my claim.

    Moreover, Exploring std::string mentions:

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

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

    0 讨论(0)
提交回复
热议问题