[Kss-devel] ree-stripout-comments branch
Balazs Ree
ree at ree.hu
Wed May 9 10:35:42 CEST 2007
Wed, 09 May 2007 09:23:27 +0200 keltezéssel Jeroen Vloothuis azt írta:
> Balazs Ree wrote:
>> This results, in full compression mode, a 104K code size, and compared
>> to the current 129K this means a 19% win at the first try. It may also
>> be a bit faster, but I can't estimate this.
>>
> Saving 19% on the download alone seems worth it.
>> Something about the technology.
>>
>> The ;;; construct works reasonable well, but it has some artifacts. I
>> am using the following patterns in the commentification:
>>
>> This cannot be used however
>>
>> - inside expressions that span multiple lines (like () or a string +)
>>
>> - inside the switch statement
>>
> Is it not possible to think of a multine stripping feature? Maybe
> something like a special debug function:
>
> function debug(func){
> func();
> }
>
> debug(function(){
> alert('pinda');
> for(var i=0; i<3; i++){
> alert('cheese '+i);
> }
> });
>
> You could write the stripper so that it would know about this special
> debug function and it would remove all calls to it.
Two problems with this. First, it should also remove the function
declarations itself since we care for space, and second it would need
parsing the javascript, while recently the stripout is implemented by a
very simple line-by-line filter.
The current ;;; solution seems to be acceptable, but as we recently
discussed with Godefroid, we should avoid using the following constructs:
/*
;;; */
whatever
;;; /*
*/
and we already have some ideas how to achieve that with small
modifications of the code.
--
Balazs Ree
More information about the Kss-devel
mailing list