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

Improve Zero-Copy Compliance: LifeTimes Parameters, Arrays Usage, and String Alternatives (Priority on Sana) #464

Open
ybensacq opened this issue Sep 25, 2024 · 6 comments
Assignees
Labels
ODHack8 Only dust 8

Comments

@ybensacq
Copy link
Contributor

ybensacq commented Sep 25, 2024

We need to review and improve the Zero-Copy compliance in the Ark Project, with a focus on the Sana module.
Some areas where improvements are needed include:

  1. Handling LifeTimes parameters effectively.
  2. Optimizing Array usage to enhance performance.

Addressing these areas will help to optimize memory usage and improve the overall efficiency of the project. Contributions and suggestions are highly appreciated, especially on Sana, as it is our priority at the moment.

Looking forward to your input!

@ybensacq ybensacq added the ODHack8 Only dust 8 label Sep 25, 2024
@JoE11-y
Copy link

JoE11-y commented Sep 26, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

With over four years in blockchain and backend development, I’ve worked across different ecosystems, handling everything from smart contract design to on-chain interactions and protocol integration. I focus on building secure, scalable, and reliable blockchain applications, managing both on-chain and off-chain infrastructure.

How I plan on tackling this issue

I'd start by reviewing the sana crate, and identifying areas in which these optimizations can be done. So first job would be to outline the possible optimizations while adhering to the zero copy principles. After the outline with feedback from team would proceed to effect the changes.

@TropicalDog17
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in Rust:
https://github.com/paradigmxyz/reth/commits/main/?author=TropicalDog17
foundry-rs/foundry#8258
https://github.com/cosmos/ibc-rs/commits/main/?author=tuantran1702

and I've do some optimization here: near/near-sdk-rs#746

How I plan on tackling this issue

As mentioned in the issue, there are some points to improve to gradually achieve zero-copy:

  • improve handling of lifetimes parameters
  • optimize Array usage for better performance
  • implement Circular buffers as alternatives to non-Zero-Copy compliant types(String...)

I will implement changes incrementally and make sure to write and conduct comprehensive tests, and figure out the way to benchmark the effectiveness of the refactor.

@Luluameh
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in Rust and memory optimization techniques like Zero-Copy. I’ve worked with Lifetimes, array management, and buffer structures to improve performance and reduce memory overhead in systems.

How I plan on tackling this issue

I’d first review the Sana module and identify areas where Lifetimes and array usage can be optimized. I’d explore using circular buffers as alternatives to strings, ensuring compliance with Zero-Copy principles. I’d also test for performance improvements and memory efficiency.

@gregemax
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience with memory optimization and performance-critical systems in Rust and TypeScript, focusing on zero-copy principles, lifetimes, and data structures like circular buffers. My work includes optimizing array usage, reducing memory overhead, and ensuring safe memory management, which will directly apply to improving Zero-Copy compliance in the Ark Project's Sana module.

How I plan on tackling this issue

I’d optimize lifetimes to reduce unnecessary copying, improve memory safety, streamline array usage by minimizing allocations with slices or fixed-size arrays, replace strings with circular buffers to reduce heap allocations, and ensure minimal data copying across functions and modules.

@fizikarubi
Copy link

fizikarubi commented Oct 1, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i am a full time blockchain engineer working on a vm running in rollup in rust
My experience with rust includes:

  1. i've contributed to a rust based javascript project in a separate account (e.g. https://github.com/jstz-dev/jstz/pull/168/files)
  2. build a substrate runtime that enables cross VM communcation (EVM <> WASM) (used my old account here https://github.com/LRUki/UVNet)
  3. contributed to celestia integration for substrate based project (private repo)

How I plan on tackling this issue

  1. figure out how to run index_pending / index_block_range in the sana crate and profile the memory usage. i'm thinking of using a crate like https://crates.io/crates/profiling
  2. once i measured the memory usage, start identifying the areas in the code / data structures that has the highest memory usage.
  3. start optimizing / refactoring
  4. run the profiler again to measure the effectiveness

I will make sure i add changes incrementally and use memory profiling.

@ybensacq ybensacq changed the title Improve Zero-Copy Compliance: LifeTimes Parameters, Arrays Usage, Circular Buffers, and String Alternatives (Priority on Sana) Improve Zero-Copy Compliance: LifeTimes Parameters, Arrays Usage, and String Alternatives (Priority on Sana) Oct 2, 2024
@od-hunter
Copy link

Hi @ybensacq , can I get this done please? I’m ready to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ODHack8 Only dust 8
Projects
None yet
Development

No branches or pull requests

7 participants