TarsCloud / Tars

Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
BSD 3-Clause "New" or "Revised" License
9.79k stars 2.08k forks source link

optimize for tc_encoder #759

Closed libjjc closed 4 years ago

libjjc commented 4 years ago

IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

Please provide enough information so that others can review your pull request:

Explain the details for making this change. What existing problem does the pull request solve?

Test plan (required)

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Code formatting

Closing issues

Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).

libjjc commented 4 years ago

在项目中偶然遇到tc_encoder转码时抛出异常,查看代码,发现tc_encoder中存在不合理之处。当遇到目标字符集未知字符时则抛出异常。由于自己是tars5的版本,于是查看了最新的版本,发现在最新的版本中貌似已经解决这个问题,但实现方式个人觉得不甚合理。频繁的string::operator+=()在长字符串转换时效率较低。考虑到向前兼容,新增了转换模式的参数。原来的调用方式可以不变,结果也不变。当使用TRANSLIT 或者 IGNORE模式时不会抛出异常。

ruanshudong commented 4 years ago

是否可以直接到 https://github.com/TarsCloud/TarsCpp 下提交pr ?

libjjc commented 4 years ago

是否可以直接到 https://github.com/TarsCloud/TarsCpp 下提交pr ?

好的,大神。已经在TarsCpp下重新提交pr了。