Opened 16 years ago

Closed 15 years ago

#1740 closed New Feature (fixed)

create automatic short aliases of objects and functions

Reported by: Alfonso Martínez de Lizarrondo Owned by:
Priority: Normal Milestone: CKEditor 3.0
Component: Project : CKPackager Version:
Keywords: Confirmed Cc:

Description

In order to improve the compression I think that this idea might provide some extra savings.

In the code there are some objects like "FCKTools", each usage of it takes 8 bytes, doing a search in the compressed code it seems that it's used around 40 times. If the packager would be able to replace those ocurrences with something like $T then it could mean a saving around 200-240 bytes (it needs to take into account that now it needs to do $T=FCKTools={};). The same principle could be applied to other objects that are used several times, and also to their functions: FCKTools.CreateBogusBR -> $T.CBBR or $T.R or whatever.

Important: the original object and function names should be preserved so there are no changes required to the dialogs or plugins calling the functions, as well as making it easy to write such external code.

The code should try to find out automatically all the objects and functions that are worth renaming: if a function is used only once then creating its alias means that now the code is bigger than the original function.

Now that we are at it, this kind of code analysis could be used to find out functions that are never called (it should just output their names because they might be called from the dialog of FCKeditor.html or any other known place), and so help review if there is some dead code lying around.

Change History (2)

comment:1 Changed 16 years ago by Frederico Caldeira Knabben

Keywords: Confirmed added
Milestone: FCKeditor 3.0

I've always thought about such kind of feature. I'm still not sure which precise solution to use for it, but there is room for improvements.

comment:2 Changed 15 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: newclosed

We are having very good results today with CKPackager. It makes it possible to rename specific names. We use it for most of the broadly used objects and namespaces, like CKEDITOR.dtd, CKEDITOR.env, CKEDITOR.tools, etc... It's enough to search for PACKAGER_RENAME in the source code to find all entries that get renamed.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy