gf icon indicating copy to clipboard operation
gf copied to clipboard

Improve the performance by reducing duplicated reflect usage on the s…

Open wln32 opened this issue 1 year ago • 11 comments

  1. 请求开始的时候,直接反射验证数据是否合法,并返回reflect.Value,后续所有操作可以不用重复反射对象
  2. 修正了测试 ghttp_z_unit_feature_request_struct_test.go:510

wln32 avatar Mar 21 '24 09:03 wln32

@wln732 The ci fails.

gqcn avatar Mar 21 '24 14:03 gqcn

涉及较核心逻辑代码调整,需要花点时间review

gqcn avatar Mar 25 '24 14:03 gqcn

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Involving core logic code adjustments, it will take some time to review.

Issues-translate-bot avatar Mar 25 '24 14:03 Issues-translate-bot

涉及较核心逻辑代码调整,需要花点时间review。 ======== 其实设置default 和in tag 那里可以直接用反射赋值了,不需要再去判断data里有没有同名的,这样实现也很直观,如果data中设置了值,那后面再走gocnv.Struct这里赋值就好了

wln32 avatar Mar 25 '24 23:03 wln32

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Involving core logic code adjustments, it will take some time to review. ======== In fact, when setting default and in tag, you can directly use reflection to assign values. There is no need to judge whether there is a value with the same name in the data. This implementation is also very intuitive. If the value is set in the data, then go to gocnv.Struct to assign the value later. Got it

Issues-translate-bot avatar Mar 25 '24 23:03 Issues-translate-bot

@wln32 这块代码看起来有点花时间,能否描述下你的改动思路?

gqcn avatar Apr 24 '24 13:04 gqcn

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@wln32 This code looks a bit time-consuming. Can you describe your idea of ​​changing it?

Issues-translate-bot avatar Apr 24 '24 13:04 Issues-translate-bot

@wln32 这块代码看起来有点花时间,能否描述下你的改动思路?

@gqcn 先放放吧,后面在更新, 其实这块的代码,可以先做请求校验,然后在用gconv做赋值,还有defaut和header那里也可以再优化优化

wln32 avatar Apr 24 '24 13:04 wln32

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@wln32 This code looks a bit time-consuming. Can you describe your ideas for changes?

I'll leave it for now, I'll update it later. In fact, for this piece of code, you can first do request verification, and then use gconv to do the assignment. You can also optimize defaut and header.

Issues-translate-bot avatar Apr 24 '24 13:04 Issues-translate-bot

@wln32 这块代码看起来有点花时间,能否描述下你的改动思路?

@gqcn 先放放吧,后面在更新, 其实这块的代码,可以先做请求校验,然后在用gconv做赋值,还有defaut和header那里也可以再优化优化

好的,这个pr我过段时间就会来看看,不过由于需要持续review但经常被打断,那我优先去看看你对http server路由的优化吧。

gqcn avatar May 30 '24 13:05 gqcn

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@wln32 This code looks a bit time-consuming. Can you describe your ideas for changes?

@gqcn Let’s put it down for now and update it later. In fact, for this piece of code, you can first perform request verification, and then use gconv to do the assignment. You can also optimize defaut and header.

Okay, I will take a look at this pr in a while, but since I need to continue review but it is often interrupted, then I will give priority to taking a look at your optimization of http server routing.

Issues-translate-bot avatar May 30 '24 13:05 Issues-translate-bot