StarknetByExample icon indicating copy to clipboard operation
StarknetByExample copied to clipboard

Feat: How to use profiler to optimize gas usage

Open julio4 opened this issue 1 year ago • 15 comments

Description

In this example, we will use cairo-profiler to learn how to analyze execution traces to help developers optimize L2 ressource usage and debug their contracts.

It should use a simple but unoptimized contract example (e.g., array manipulation or mapping iteration) to demonstrate how to:

  • Run cairo-profiler
  • Read and interpret its output (mainly with graph and flame graph views from pprof)
  • Identify step-heavy operations
  • Apply optimizations there
  • Compare before/after metrics

ODHack

To be eligible for additional rewards, be sure to review and follow the ODHack Common Guidelines and Contributing Guidelines. Be sure to join the telegram group and introduce yourself.

julio4 avatar Nov 22 '24 04:11 julio4

Hello @julio4 can I be assigned to work on this?

raizo07 avatar Nov 22 '24 04:11 raizo07

Hi @julio4 please can I work on this issue

ShantelPeters avatar Nov 22 '24 04:11 ShantelPeters

Hi, I am proficient Blockchain developer expert in Cairo , Rust and Solidity and also in web development. I have contributed many cairo ,rust projects like chainevents , arkprojects etc . please /assign this issue . Thank You

ryzen-xp avatar Nov 22 '24 04:11 ryzen-xp

Hello @julio4 please can I work on this issue

Jemiiah avatar Nov 22 '24 04:11 Jemiiah

I'd love to work on this!

OWK50GA avatar Nov 22 '24 05:11 OWK50GA

I’d love to work on this task.

Amarjeet325 avatar Nov 22 '24 05:11 Amarjeet325

Is it okay if I tackle this?

mimisavage avatar Nov 22 '24 07:11 mimisavage

Could I take on this issue?

Supa-mega avatar Nov 22 '24 10:11 Supa-mega

Hi, i would like to take this problem. I have experience on profiler, thanks

htiennv avatar Nov 22 '24 12:11 htiennv

May I work on this issue @EjembiEmmanuel?

I am a cairo dev with extensive experience in building on cairo and also a regular contributor at @keep-starknet-strange and the starknet ecosystem in general. You can see my PoW on my github and onlydust profile.

my approach: I will create a new simple contract as an example which will be using the cairo-profiler to demonstrate all the aspects mentioned in the issue.

eta: 4 days

SoarinSkySagar avatar Nov 22 '24 18:11 SoarinSkySagar

I just graduated from a basecamp, completed startklings 2.0 and Node Guardians quests. Let me to do to acquire more real life application and contribution. ETA: 3 day

emarc99 avatar Nov 22 '24 21:11 emarc99

Background: https://nodeguardians.io/character/baitcode + several contributions to notable cairo project. Will happily do that. I'd pick an binary Merkel tree bilding algorithm from the operation log. It will include array iteration, hashing, bitwise operations and recursion. Will be interesting to work through this.

baitcode avatar Nov 22 '24 23:11 baitcode

I’d love to work on this task.

abdegenius avatar Nov 23 '24 20:11 abdegenius

@raizo07 Any help needed on this issue?

julio4 avatar Nov 27 '24 10:11 julio4

@julio4 I'm on it ser

raizo07 avatar Nov 27 '24 10:11 raizo07