Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blocks: change Block to a value struct #59

Closed
wants to merge 1 commit into from

Conversation

Jorropo
Copy link
Contributor

@Jorropo Jorropo commented Jan 26, 2023

The goal is to stop doing two allocations for each block (now it will only allocate the []byte buffer, and pass the cid.Cid, []byte pair by decomposed registers or stack).
This way of changing does not change the syntax for trivial uses of block.Block, so in theory we will have to update only producers of block.Block, not consumers.

Depends on (include) #58
Fixes ipfs/go-block-format#45

Todo:

  • Test bubbling up this PR in Kubo and sees how much break.
  • Test bubbling up this PR in Lotus and sees how much break.

@Jorropo Jorropo self-assigned this Jan 26, 2023
@codecov
Copy link

codecov bot commented Jan 26, 2023

Codecov Report

Merging #59 (34290c3) into main (00e0249) will increase coverage by 34.00%.
The diff coverage is 78.57%.

❗ Current head 34290c3 differs from pull request most recent head d8aae0d. Consider uploading reports for the commit d8aae0d to get more accurate results

Impacted file tree graph

@@             Coverage Diff             @@
##             main      ipfs/boxo#59       +/-   ##
===========================================
+ Coverage   29.75%   63.75%   +34.00%     
===========================================
  Files         100       33       -67     
  Lines       11268     1719     -9549     
===========================================
- Hits         3353     1096     -2257     
+ Misses       7547      485     -7062     
+ Partials      368      138      -230     
Impacted Files Coverage Δ
blocks/blocks.go 64.00% <78.57%> (ø)
routing/http/server/server.go 62.60% <0.00%> (-0.33%) ⬇️
gateway/handler.go
gateway/handler_unixfs_dir.go
...l/sessioninterestmanager/sessioninterestmanager.go
bitswap/testnet/virtual.go
examples/unixfs-file-cid/main.go
...client/internal/messagequeue/donthavetimeoutmgr.go
bitswap/bitswap.go
bitswap/network/options.go
... and 59 more

The goal is to stop doing two allocations for each block (now it will only allocate the `[]byte` buffer, and pass the `cid.Cid, []byte` pair by decomposed registers or stack).

This way of changing does not change the syntax for trivial uses of block.Block, so in theory we will have to update only producers of block.Block, not consumers.

Fixes #57
@Jorropo
Copy link
Contributor Author

Jorropo commented Mar 3, 2023

Replaced by #192

@Jorropo Jorropo closed this Mar 3, 2023
@Jorropo Jorropo deleted the value-block branch March 3, 2023 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

valuify blocks.Block
1 participant