sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[dart2js] `init.types` table has unused entries

Open rakudrama opened this issue 5 months ago • 0 comments

A certain large app has ~9.5k entries (strings) in the init.types table. References to this table, via $signature: properties and arguments to tear-off installers, account for only about 2.5k entries. This suggests entries are being created for entities that do not have tear-offs and are not closures.

Removing the unused entries has a potential saving of > 2/3 the size of this table, or about 0.7% of the main unit.

The integer indexes into the table are efficient:

  • Smaller than the corresponding entry (e.g. 123 vs "ab(xy)")
  • The table entries are parsed on demand, shifting parse cost from initial load to actual need
  • Since the table entry strings are replaced with the parsed Rti, closures with the same type share the parsing cost

Even though there are some entries with many uses, about 70% of the entries have one use. The indirection through the table is wasteful for these entries, though it is not clear where to store the parsed Rti (it is undesirable to update an entry on a prototype).

There are about 20k closures and 30k (static and instance) tear-offs in the large app.

rakudrama avatar Jun 14 '25 03:06 rakudrama