RE: [PHP-DOC] Re: Idea: quickref.swf
| From: | Mitja Slenc | Date: | Mon, 29 Sep 2003 11:15:02 +0000 |
| Subject: | RE: [PHP-DOC] Re: Idea: quickref.swf | ||
| References: | 1 | Groups: | php.doc php.mirrors |
| Request: | Send a blank email to phpdoc+get-969356452@lists.php.net to get a copy of this message | ||
I think attachments are not allowed. Anyway, I completed the stuff.
You can see it work at
http://www.xs0.com/php/index.html
The function list is
http://www.xs0.com/php/funclist.txt
which is basically the one from cvs.php.net with added echo and print
The JavaScript is at
http://www.xs0.com/php/functions.js
It's cryptic, because I wanted the file size as small as possible; still,
the HTML output is on separate lines so it can be updated more easily. It's
currently 19463 bytes. gzipped funclist.txt is 12648, so I guess this is a
pretty good result.
You can generate a new one with
http://www.xs0.com/php/funclist.zip
Just update funclist.txt and run make.
I tested with IE6 and Mozilla/FireBird. Seems to work...
The nice thing is that it can be included just before </body>, so everything
else works without any additional waiting...
And for the details on compression:
First, the function list is compressed with something similar to prefix
compression, except it can work on multiple levels. For example:
test
test_abc
test_foo
test_foo_bar
test_foo_bcp
test_foo_bxs
will get compressed to
test[_abc,_foo[_b(ar,cp,xs)]]
It is done by considering all possible prefixes and calculating the length
reduction for each. It's probably not optimal, but I can't think of anything
better. The difference between () and [] is that [] also includes the prefix
in the uncompressed list, so
array
array_search
becomes array[_search], while
array_search
array_lookup
becomes array_(search,lookup)
After this is done, all unused characters between ASCIIs 32 and 124 are used
for commonly appearing sequences of characters in the compressed string from
above. } is used as a separator, because it is shorter than ','. Again, all
sequences up to length 7 are considered and length reduction is calculated.
I tried with sequences up to 15 characters, but there was no improvement,
and it is slow enough as-is.
The first step reduces file size from 42k to 23k, and the second by further
5k. There's about 2k of overhead for decompression and displaying.
Mitja
-----Original Message-----
From: Gabor Hojtsy [mailto:gabor@hojtsy.hu]
Sent: 28. september 2003 19:32
To: Mitja Slenc
Cc: phpdoc@lists.php.net; webmaster@php.net
Subject: Re: [PHP-DOC] Re: Idea: quickref.swf
Mitja sent a compression method, but he accidentaly only sent it to me,
so I am reposting it here. It should probably be taken into account.
Goba