You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/01/03 07:13:52 UTC

[GitHub] [rocketmq-client-go] xujianhai666 opened a new pull request #361: feat: use pool for header codec

xujianhai666 opened a new pull request #361: feat: use pool for header codec
URL: https://github.com/apache/rocketmq-client-go/pull/361
 
 
   Closes #360

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [rocketmq-client-go] codecov-io commented on issue #361: feat: use pool for header codec

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #361: feat: use pool for header codec
URL: https://github.com/apache/rocketmq-client-go/pull/361#issuecomment-570487237
 
 
   # [Codecov](https://codecov.io/gh/apache/rocketmq-client-go/pull/361?src=pr&el=h1) Report
   > Merging [#361](https://codecov.io/gh/apache/rocketmq-client-go/pull/361?src=pr&el=desc) into [native](https://codecov.io/gh/apache/rocketmq-client-go/commit/598c979ebd6db2212776e8e38d7f623090360481?src=pr&el=desc) will **decrease** coverage by `0.11%`.
   > The diff coverage is `30%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/rocketmq-client-go/pull/361/graphs/tree.svg?width=650&token=CiV9ofPkG3&height=150&src=pr)](https://codecov.io/gh/apache/rocketmq-client-go/pull/361?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           native     #361      +/-   ##
   ==========================================
   - Coverage   26.28%   26.17%   -0.12%     
   ==========================================
     Files          47       48       +1     
     Lines        5535     5543       +8     
   ==========================================
   - Hits         1455     1451       -4     
   - Misses       3889     3901      +12     
     Partials      191      191
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq-client-go/pull/361?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [internal/remote/remote\_client.go](https://codecov.io/gh/apache/rocketmq-client-go/pull/361/diff?src=pr&el=tree#diff-aW50ZXJuYWwvcmVtb3RlL3JlbW90ZV9jbGllbnQuZ28=) | `48.14% <100%> (-2.65%)` | :arrow_down: |
   | [primitive/pool.go](https://codecov.io/gh/apache/rocketmq-client-go/pull/361/diff?src=pr&el=tree#diff-cHJpbWl0aXZlL3Bvb2wuZ28=) | `12.5% <12.5%> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/rocketmq-client-go/pull/361?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/rocketmq-client-go/pull/361?src=pr&el=footer). Last update [598c979...0dd9573](https://codecov.io/gh/apache/rocketmq-client-go/pull/361?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [rocketmq-client-go] wenfengwang commented on a change in pull request #361: [ISSUE #360] feat: use pool for header codec

Posted by GitBox <gi...@apache.org>.
wenfengwang commented on a change in pull request #361: [ISSUE #360] feat: use pool for header codec
URL: https://github.com/apache/rocketmq-client-go/pull/361#discussion_r362732678
 
 

 ##########
 File path: primitive/pool.go
 ##########
 @@ -0,0 +1,40 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package primitive
+
+import (
+	"sync"
+)
+
+var headerPool = sync.Pool{}
+
+func init() {
+	headerPool.New = func() interface{} {
+		return make([]byte, 4)
+	}
+}
+
+func GetHeader() []byte {
+	d := headerPool.Get().([]byte)
+	//d = (d)[:0]
 
 Review comment:
   please remove

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [rocketmq-client-go] wenfengwang merged pull request #361: [ISSUE #360] feat: use pool for header codec

Posted by GitBox <gi...@apache.org>.
wenfengwang merged pull request #361: [ISSUE #360] feat: use pool for header codec
URL: https://github.com/apache/rocketmq-client-go/pull/361
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services