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

Tweak cost of running concat #1269

Merged
merged 4 commits into from
Aug 7, 2023
Merged

Tweak cost of running concat #1269

merged 4 commits into from
Aug 7, 2023

Conversation

imalsogreg
Copy link
Contributor

Tweak the gas costing for the concat builtin to account for both the number of strings being concatenated, and the length of those strings.

PR checklist:

  • Test coverage for the proposed changes
  • PR description contains example output from repl interaction or a snippet from unit test output
  • N/A Documentation has been updated if new natives or FV properties have been added. To generate new documentation, issue cabal run tests. If they pass locally, docs are generated.
  • Any changes that could be relevant to users have been recorded in the changelog
  • N/A In case of changes to the Pact trace output (pact -t), make sure pact-lsp is in sync.

Additionally, please justify why you should or should not do the following:

  • Confirm replay/back compat
  • Benchmark regressions
  • (For Kadena engineers) Run integration-tests against a Chainweb built with this version of Pact

src/Pact/Gas/Table.hs Outdated Show resolved Hide resolved
src/Pact/Gas/Table.hs Outdated Show resolved Hide resolved
src/Pact/Gas/Table.hs Outdated Show resolved Hide resolved
src/Pact/Native.hs Show resolved Hide resolved
src/Pact/Native.hs Show resolved Hide resolved
@kadena-io kadena-io deleted a comment from rsoeldner Aug 7, 2023
src/Pact/Gas/Table.hs Outdated Show resolved Hide resolved
src/Pact/Native.hs Show resolved Hide resolved
src/Pact/Gas/Table.hs Outdated Show resolved Hide resolved
src/Pact/Gas/Table.hs Outdated Show resolved Hide resolved
src/Pact/Native.hs Outdated Show resolved Hide resolved
src/Pact/Native.hs Show resolved Hide resolved
in
GTextConcatenation nChars nStrings
computeGas' i concatGasCost $ let
ls' = V.toList ls
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we turning it into a list here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We pass ls' to T.concat, and contrary to what you'd expect T.concat is monomorphic and demands a list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really that's intense. I don't want to armchair microbench but i'd assume vector concat and then a single toList call woudl be better, but I'm not going to stall the PR over it

@imalsogreg imalsogreg merged commit 9a0b555 into master Aug 7, 2023
7 checks passed
@imalsogreg imalsogreg deleted the greg/gas-concat branch August 7, 2023 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants