You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devlake.apache.org by Klesh Wong <kl...@apache.org> on 2022/06/08 09:54:55 UTC

[discuss] upgrade golang to 1.18

Hi, All,


  Since golang 1.18 had been released for a while, I'm wondering if we 
should switch to it from 1.17. The reason why I propose this upgrade is 
due to the fact we have used many `reflect` inside our code base, and 
some of them could be replaced by `generic` feature introduced in golang 
`1.18`.


  For example, we have this `batch_save` to help us insert multiple 
records in one go, which could boost performance drastically, this kind 
of operation is the same for different tables except the `type` might 
vary. We don't repeat the whole `class` again and again, it's tedious 
and unmaintainable. So, we use `reflect` and `interface{}` as a measure 
to handle different `type`s of entities. This approach works, but not 
without penalty, it is a bit slower and error-prone without type-checking.


  By adopting `generic`, we can improve the performance in many places 
including the case above. Other places like:

 1. `plugin/helper/connection.go`
 2. `plugin/helper/iterator.go`


Klesh Wong

回复: [discuss] upgrade golang to 1.18

Posted by Yanghui Lin <ya...@merico.dev.INVALID>.
I think It's a good try. There isn't any breaking change in go 1.18
________________________________
发件人: Klesh Wong <kl...@apache.org>
发送时间: 2022年6月8日 17:54
收件人: dev@devlake.apache.org <de...@devlake.apache.org>
主题: [discuss] upgrade golang to 1.18

Hi, All,


  Since golang 1.18 had been released for a while, I'm wondering if we
should switch to it from 1.17. The reason why I propose this upgrade is
due to the fact we have used many `reflect` inside our code base, and
some of them could be replaced by `generic` feature introduced in golang
`1.18`.


  For example, we have this `batch_save` to help us insert multiple
records in one go, which could boost performance drastically, this kind
of operation is the same for different tables except the `type` might
vary. We don't repeat the whole `class` again and again, it's tedious
and unmaintainable. So, we use `reflect` and `interface{}` as a measure
to handle different `type`s of entities. This approach works, but not
without penalty, it is a bit slower and error-prone without type-checking.


  By adopting `generic`, we can improve the performance in many places
including the case above. Other places like:

 1. `plugin/helper/connection.go`
 2. `plugin/helper/iterator.go`


Klesh Wong

Re: [discuss] upgrade golang to 1.18

Posted by Yingchu Chen <Yi...@merico.dev.INVALID>.
Great proposal. When do we start?

获取 Outlook for iOS<https://aka.ms/o0ukef>
________________________________
发件人: Klesh Wong <kl...@apache.org>
发送时间: Wednesday, June 8, 2022 5:54:55 PM
收件人: dev@devlake.apache.org <de...@devlake.apache.org>
主题: [discuss] upgrade golang to 1.18

Hi, All,


  Since golang 1.18 had been released for a while, I'm wondering if we
should switch to it from 1.17. The reason why I propose this upgrade is
due to the fact we have used many `reflect` inside our code base, and
some of them could be replaced by `generic` feature introduced in golang
`1.18`.


  For example, we have this `batch_save` to help us insert multiple
records in one go, which could boost performance drastically, this kind
of operation is the same for different tables except the `type` might
vary. We don't repeat the whole `class` again and again, it's tedious
and unmaintainable. So, we use `reflect` and `interface{}` as a measure
to handle different `type`s of entities. This approach works, but not
without penalty, it is a bit slower and error-prone without type-checking.


  By adopting `generic`, we can improve the performance in many places
including the case above. Other places like:

 1. `plugin/helper/connection.go`
 2. `plugin/helper/iterator.go`


Klesh Wong

Re: [discuss] upgrade golang to 1.18

Posted by Zikuan An <zi...@merico.dev.INVALID>.
Good advice, this will give a relatively big boost to Apache DevLake.


> 2022年6月8日 17:54,Klesh Wong <kl...@apache.org> 写道:
> 
> Hi, All,
> 
> 
>  Since golang 1.18 had been released for a while, I'm wondering if we should switch to it from 1.17. The reason why I propose this upgrade is due to the fact we have used many `reflect` inside our code base, and some of them could be replaced by `generic` feature introduced in golang `1.18`.
> 
> 
>  For example, we have this `batch_save` to help us insert multiple records in one go, which could boost performance drastically, this kind of operation is the same for different tables except the `type` might vary. We don't repeat the whole `class` again and again, it's tedious and unmaintainable. So, we use `reflect` and `interface{}` as a measure to handle different `type`s of entities. This approach works, but not without penalty, it is a bit slower and error-prone without type-checking.
> 
> 
>  By adopting `generic`, we can improve the performance in many places including the case above. Other places like:
> 
> 1. `plugin/helper/connection.go`
> 2. `plugin/helper/iterator.go`
> 
> 
> Klesh Wong