You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by "Peter Bacsko (Jira)" <ji...@apache.org> on 2023/04/28 15:11:00 UTC

[jira] [Updated] (YUNIKORN-1713) Pass EventRecord as value instead of pointer

     [ https://issues.apache.org/jira/browse/YUNIKORN-1713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter Bacsko updated YUNIKORN-1713:
-----------------------------------
    Description: 
Currently, we're passing around {{si.EventRecord}} objects as a pointer to a value. The idea is that by keeping just a single value in memory, we reduce copying. However, this causes heap allocations, which puts pressure on the GC, plus dereferencing also has costs. 

Also, modification to a structure is reflected in the original object. We rarely want this without adequate locking. 

Since this is a simple struct that is based on a protobuf definition, we should abandon heavy pointer usage and just pass it as value.

See a relevant benchmark about passing  struct as value vs pointer:
https://medium.com/a-journey-with-go/go-should-i-use-a-pointer-instead-of-a-copy-of-my-struct-44b43b104963

  was:
Currently, we're passing around {{si.EventRecord}} objects as a pointer to a value. The idea is that by keeping just a single value in memory, we reduce copying. However, this causes heap allocations, which puts pressure on the GC, plus dereferencing also has costs. 

Also, modification to a structure is reflected in the original object. We rarely want this without adequate locking. 

Since this is a simple struct that is based on a protobuf definition, we should abandon heavy pointer usage and just pass it as value.

See a relevant benchmark about struct passing value vs pointer:
https://medium.com/a-journey-with-go/go-should-i-use-a-pointer-instead-of-a-copy-of-my-struct-44b43b104963


> Pass EventRecord as value instead of pointer
> --------------------------------------------
>
>                 Key: YUNIKORN-1713
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-1713
>             Project: Apache YuniKorn
>          Issue Type: Sub-task
>          Components: core - scheduler
>            Reporter: Peter Bacsko
>            Assignee: Peter Bacsko
>            Priority: Major
>
> Currently, we're passing around {{si.EventRecord}} objects as a pointer to a value. The idea is that by keeping just a single value in memory, we reduce copying. However, this causes heap allocations, which puts pressure on the GC, plus dereferencing also has costs. 
> Also, modification to a structure is reflected in the original object. We rarely want this without adequate locking. 
> Since this is a simple struct that is based on a protobuf definition, we should abandon heavy pointer usage and just pass it as value.
> See a relevant benchmark about passing  struct as value vs pointer:
> https://medium.com/a-journey-with-go/go-should-i-use-a-pointer-instead-of-a-copy-of-my-struct-44b43b104963



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org