FuelLabs / fuels-ts

Fuel Network Typescript SDK
https://docs.fuel.network/docs/fuels-ts/
Apache License 2.0
44.16k stars 1.34k forks source link

Typegen - Improve `bytecode` compression #1462

Closed arboleya closed 1 month ago

arboleya commented 10 months ago

Today, we read binaries after forc build and hexilify them.

The hex string is then embedded within the typegen generated Typescript factory class.

However, @luizstacio reported achieving a 70% size reduction using the method below:

  1. Read binaries
  2. Convert to Byte Array
  3. Gzip the Byte Array
  4. Encode the result using Base64

The reverse must be done for decoding, and the reduction is considerable.

We should look into that.

Refs:

dmihal commented 3 months ago

Just thought of this during your presentation today @arboleya, would be a nice simple improvement to reduce code size.