Skip to content

Refactor: function name createElement is 12 bytes too long #25167

@davidrenne

Description

@davidrenne

Wouldn't it be great for bundle sizes around the world to be reduced from 13 bytes per element where jsx transposes a 13 character function name down to a single byte function name called 'c' or 'e' (12 bytes per node rendered sounds like huge savings to me)

I am sure there are crazy people out there directly calling createElement, so keep the function name there and fix the jsx transpiler to use the one byte function name for all the normal people who never write a lick of createElement.

Can this be looked into or advise me on where I can hijack my jsx transpiler to do this globally. I want to see just how much savings I have on a 7 year old application with over 1400 components and probably at least 14mb of gzipped bundles chunked out.

Thanks for being awesome react maintainers!

Just close if you think this is a garbage idea. I'm just trying to save 12 bytes " n nodes in their entire application. Maybe it could save some apps 100kb unminified if they have a large enough dependency tree of JSX output.

Next my mission is to find a webpack plug in to rename react globally to an alias like R. so everytime webpack imports react I'll save 4 more bytes (that's not your problem) but if I got both the library and create Element down to two bytes from previously 18 bytes per create element call. That's what I am interested in seeing just how many create Elements are in my bundle and if it reduces it by 100kb or 30kb gzipped I think that's a win in my book.

I'm sure my calculations are not right on how many createElement calls there are in some of my apps, but very verbose html apps with huge imports of very Dom heavy jsx trees could probably benefit from a 2 byte package and function call.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions