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

refactor(memory): memory usage improvements #2098

Merged
merged 4 commits into from
May 7, 2024
Merged

Conversation

onur-ozkan
Copy link
Member

self-explanatory

@onur-ozkan onur-ozkan changed the title refactor(memory): use preallocated String to improve memory usage in folding refactor(memory): prefer preallocated String Apr 23, 2024
@onur-ozkan onur-ozkan changed the title refactor(memory): prefer preallocated String refactor(memory): memory usage improvements Apr 23, 2024
@onur-ozkan onur-ozkan added in progress Changes will be made from the author and removed under review labels Apr 23, 2024
@onur-ozkan onur-ozkan marked this pull request as draft April 23, 2024 05:55
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@onur-ozkan onur-ozkan force-pushed the preallocated-fold branch 6 times, most recently from ae75a3b to 7b041d6 Compare April 23, 2024 17:43
@onur-ozkan onur-ozkan marked this pull request as ready for review April 23, 2024 17:43
@onur-ozkan onur-ozkan added micro-opt Optimization at very minimal level under review and removed in progress Changes will be made from the author labels Apr 23, 2024
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@shamardy
Copy link
Collaborator

shamardy commented May 6, 2024

@onur-ozkan please fix conflicts in this PR so that I can approve it.

@onur-ozkan
Copy link
Member Author

@onur-ozkan please fix conflicts in this PR so that I can approve it.

Done.

@shamardy shamardy merged commit cdf032b into dev May 7, 2024
22 of 25 checks passed
@shamardy shamardy deleted the preallocated-fold branch May 7, 2024 11:26
@bsodmike
Copy link

bsodmike commented May 7, 2024

Hi @onur-ozkan curious to learn the advantage of calling vec![] rather than a follow up push, is this due to an extra memory allocation via the heap (in the case of std)?

I assume you're trying to avoid calling .push() on single element vectors?

@onur-ozkan
Copy link
Member Author

Hi @onur-ozkan curious to learn the advantage of calling vec![] rather than a follow up push, is this due to an extra memory allocation via the heap (in the case of std)?

I assume you're trying to avoid calling .push() on single element vectors?

Makes it easier for compiler to optimize (as it stays immutable explicitly) the memory usage.

dimxy added a commit to dimxy/komodo-defi-framework that referenced this pull request May 9, 2024
* dev:
  fix(eth): remove my_address from sign_and_send_transaction_with_keypair (KomodoPlatform#2115)
  fix(utxo-swap): apply events occurred while taker down (KomodoPlatform#2114)
  refactor(memory): memory usage improvements (KomodoPlatform#2098)
dimxy added a commit to dimxy/komodo-defi-framework that referenced this pull request May 14, 2024
* dev:
  feat(tendermint): pubkey-only activation and unsigned tx (KomodoPlatform#2088)
  fix(tests): set txfee for some tbtc tests (KomodoPlatform#2116)
  fix(eth): remove my_address from sign_and_send_transaction_with_keypair (KomodoPlatform#2115)
  fix(utxo-swap): apply events occurred while taker down (KomodoPlatform#2114)
  refactor(memory): memory usage improvements (KomodoPlatform#2098)
  feat(app-dir): implement root application dir `.kdf` (KomodoPlatform#2102)
  fix tendermint fee calculation (KomodoPlatform#2106)
  update dockerfile (KomodoPlatform#2104)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
micro-opt Optimization at very minimal level Refactoring under review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants