flow-go icon indicating copy to clipboard operation
flow-go copied to clipboard

code gen parseRestrict wrappers

Open pattyshack opened this issue 2 years ago • 6 comments

Prep work for adding trace/meter logic to the wrapper.

(I don't really like python3 and haven't done any serious development using it, but ppl will probably hate me if I use python2 instead)

pattyshack avatar Oct 14 '22 20:10 pattyshack

FVM Benchstat comparison

This branch with compared with the base branch onflow:master commit 1bc1cb079bab87c90656196c36023da7fc5ce26f

The command (for i in {1..10}; do go test ./fvm ./engine/execution/computation --bench . --tags relic -shuffle=on --benchmem --run ^$; done) was used.

Collapsed results for better readability

old.txtnew.txt
time/opdelta
ComputeBlock/16/cols/128/txes-25.29s ± 0%5.08s ± 0%~(p=1.000 n=1+1)
 
us/txdelta
ComputeBlock/16/cols/128/txes-22.58k ± 0%2.48k ± 0%~(p=1.000 n=1+1)
 
alloc/opdelta
ComputeBlock/16/cols/128/txes-21.28GB ± 0%1.28GB ± 0%~(p=1.000 n=1+1)
 
allocs/opdelta
ComputeBlock/16/cols/128/txes-219.9M ± 0%19.9M ± 0%~(p=1.000 n=1+1)
 

github-actions[bot] avatar Oct 14 '22 20:10 github-actions[bot]

Codecov Report

Merging #3398 (cfcdb7a) into master (2440283) will decrease coverage by 1.94%. The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3398      +/-   ##
==========================================
- Coverage   55.47%   53.52%   -1.95%     
==========================================
  Files         752      546     -206     
  Lines       68494    46466   -22028     
==========================================
- Hits        37997    24873   -13124     
+ Misses      27424    19423    -8001     
+ Partials     3073     2170     -903     
Flag Coverage Δ
unittests 53.52% <ø> (-1.95%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
network/p2p/dns/resolver.go 91.51% <0.00%> (-4.85%) :arrow_down:
ledger/complete/wal/wal.go 55.02% <0.00%> (-1.92%) :arrow_down:
ledger/complete/wal/checkpointer.go 63.12% <0.00%> (-0.52%) :arrow_down:
ledger/complete/ledger.go 62.25% <0.00%> (-0.35%) :arrow_down:
cmd/execution_config.go 0.00% <0.00%> (ø)
cmd/execution_builder.go 0.00% <0.00%> (ø)
fvm/environment/parse_restricted_checker.go
engine/access/rest/request/script.go
fvm/state/state.go
engine/consensus/approvals/signature_collector.go
... and 214 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Oct 14 '22 20:10 codecov-commenter

exciting initiative.

  • question: why use Python instead of Golang's own text/template? if we add new language in flow-go, we may want to update the install-tools target in the main Makefile, though i'd still prefer not to introduce new language dep into the repo, unless there's strong reasons for that.
  • you may also want to add this new code generation step into https://github.com/onflow/flow-go/blob/master/Makefile#L122
  • accidental commit of that binary file ".codes.go.swap"?

Tonix517 avatar Oct 14 '22 20:10 Tonix517

  1. python cuz i was lazy. but it's a fair point that not everyone will have python install. i'll convert to golang instead (i hate python3, but I hate golang text/template even more)

  2. i don't think we need to regenerate these regularly

  3. yeah, .codes.go.swap was an accidental commit

pattyshack avatar Oct 14 '22 21:10 pattyshack

did a quick search on github and found this: https://github.com/dave/jennifer. not sure if it's battle-tested though.

Tonix517 avatar Oct 14 '22 21:10 Tonix517

(my hobby template generator looks better https://github.com/pattyshack/abc/tree/master/src/template =P)

i'll probably go with (gogo)proto style generation instead of text/template. it works pretty well in practice.

pattyshack avatar Oct 14 '22 21:10 pattyshack

switched to golang based code gen + added to makefile

pattyshack avatar Oct 17 '22 18:10 pattyshack

LGTM - please remove .codes.go.swp before merging.

.codes.go.swp is already in the main branch (I merged it accidently in a previous pr). this removes it

pattyshack avatar Oct 17 '22 21:10 pattyshack

bors merge

pattyshack avatar Oct 19 '22 16:10 pattyshack

Build failed (retrying...):

bors[bot] avatar Oct 19 '22 17:10 bors[bot]

bors retry

pattyshack avatar Oct 19 '22 17:10 pattyshack

Already running a review

bors[bot] avatar Oct 19 '22 17:10 bors[bot]