# Starknet v0.13.0: Performance Improvement

**URL:** <https://community.starknet.io/t/starknet-v0-13-0-performance-improvement/112644>\
**Category:** 🆙 Versions Upgrade\
**Created:** [January 11, 2024, 10:39am UTC](https://community.starknet.io/t/starknet-v0-13-0-performance-improvement/112644 "2024-01-11T10:39:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilia](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/ilia/32/1318_2.png) [@ilia](https://community.starknet.io/u/ilia)\
**Post date:** [January 11, 2024, 10:39am UTC](https://community.starknet.io/t/starknet-v0-13-0-performance-improvement/112644/1 "2024-01-11T10:39:06Z")

</div>

Coming to Mainnet on Jan 15!

On Dec 13, 2023, we posted details about Starknet v0.13.0 on the community forum. [The post](https://community.starknet.io/t/starknet-v0-13-0-support-for-fee-payment-in-strk-reduced-transaction-fees/109608/1) outlined the main changes: [v3 transactions](https://community.starknet.io/t/starknet-v0-13-0-support-for-fee-payment-in-strk-reduced-transaction-fees/109608#v3-transactions-1) and [transaction fee reductions](https://community.starknet.io/t/starknet-v0-13-0-support-for-fee-payment-in-strk-reduced-transaction-fees/109608).

Over the last few weeks, internal stress-testing revealed several openings for performance improvements: some Python code begging to be replaced with Rust, an optimization of the `ec_op` builtin to use projective coordinates instead of affine coordinates, and some caching.

After concentrated efforts, all of these improvements were implemented. Before diving into the results, an important schedule clarification:

- The Mainnet upgrade date of Jan 10, 2024 did not include these performance improvements. The holdup is due to our wish to run these changes a few more days on testnet.
- These performance improvements will be included in an additional Mainnet upgrade, which will take place on **Jan 15, 2024**.

Now here is what you all want to see: below is a table detailing the results of the various optimizations that were done. The example we choose is for `erc20_transfer`.

| `erc20_transfer` | Cairo0 account & token contract | Cairo account & token contract |
| --- | --- | --- |
| Pre-improvements | 80 TPS | 18 TPS |
| Post-improvements | 150 TPS | 70 TPS |

There are several caveats to be made:

1. As you can see, there is a gap in performance between Cairo0 and Cairo. The gap is due to the powerful safety properties provided by [Sierra](https://docs.starknet.io/documentation/architecture_and_concepts/Smart_Contracts/cairo-and-sierra/). However, as shown in the table, it can be reduced considerably by careful optimization. Following the optimizations, the gap between Cairo0 and Cairo was halved largely thanks to the `ec_op` optimization which accelerated the validate of the Cairo accounts used in our testing. Indeed the tested Cairo0 accounts used the `ECDSA` builtin which is illegal in Sierra (and therefore Cairo) as it can fail.
2. Throughput in practice depends on many factors. A major one is the % of the block using `ec_op`, which enjoys a roughly 60x speedup. This means a block with few such validate functions, or few multicalls to such accounts, will exhibit a smaller speedup compared to the erc20\_transfer scenario with many separate transactions.
3. In particular, since the “pure” scenario of transfers is not the standard traffic on Starknet, the practical throughput improvement on Mainnet will likely be less drastic in the average case.

---

<div class="post-metadata">

**Author:** ![sgc-code](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/sgc-code/32/71664_2.png) [@sgc-code](https://community.starknet.io/u/sgc-code)\
**Post date:** [January 11, 2024, 11:43am UTC](https://community.starknet.io/t/starknet-v0-13-0-performance-improvement/112644/2 "2024-01-11T11:43:08Z")

</div>

Hi, thanks for the update.  
Hope you can clarify a few things:  
Does it mean that today the fees are calculated as described in this document [Gas and transaction fees (Prior to Starknet 0.13.0) :: Starknet documentation](https://docs.starknet.io/documentation/architecture_and_concepts/Network_Architecture/fee-mechanism-pre-v0.13.0/)

Also, what are the numbers in the table above?

---

<div class="post-metadata">

**Author:** ![ilia](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/ilia/32/1318_2.png) [@ilia](https://community.starknet.io/u/ilia)\
**Post date:** [January 11, 2024, 12:25pm UTC](https://community.starknet.io/t/starknet-v0-13-0-performance-improvement/112644/3 "2024-01-11T12:25:10Z")

</div>

Hey @sgc-code thanks for the quick reply!

- No - the correct reference is now [after v0.13.0](https://docs.starknet.io/documentation/architecture_and_concepts/Network_Architecture/fee-mechanism/).
- The numbers are erc-20 transfers per second. I clarified this in the table now.

---

<div class="post-metadata">

**Author:** ![sgc-code](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/sgc-code/32/71664_2.png) [@sgc-code](https://community.starknet.io/u/sgc-code)\
**Post date:** [January 11, 2024, 1:33pm UTC](https://community.starknet.io/t/starknet-v0-13-0-performance-improvement/112644/4 "2024-01-11T13:33:14Z")

</div>

Great to hear many optimizations are already in place.  
So if the new step/builtin costs are already included, and the L1 DA optimization is also available now. Can you clarify what are the improvements that will take effect on Jan 15th?

---

<div class="post-metadata">

**Author:** ![dtuios](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/dtuios/32/79286_2.png) [@dtuios](https://community.starknet.io/u/dtuios)\
**Post date:** [January 15, 2024, 1:02am UTC](https://community.starknet.io/t/starknet-v0-13-0-performance-improvement/112644/5 "2024-01-15T01:02:49Z")

</div>

is this upgrade V0.13.1?
