Gabor Hojtsy wrote:
So it seems I really learned something useful during my first CS year...

I have reworked the search function, it now uses 'binary searching'. This greatly reduces the search times. It needs some debugging, but the first results seem promising. I have also changed the array loading code, it should load faster this way (due to the way arrays are handled internally). The file size is about 56kB (which is just over twice the size of the PHP main page, without images).


OK, we can reduce th size significantly if we use a function to build up the array of function names, like:

addWithPrefix("cdpf_set_", new Array(
"action_url",
"char_spacing",
"creator",
"current_page",
"font",
"font_directories",
"font_map_file",
"horiz_scaling",
"keywords",
"leading",
"page_animation",
"subject",
"text_matrix",
"text_pos",
"text_rendering",
"text_rise",
"title",
"viewer_preferences",
"word_spacing"));

This might not be the correct JS sytnax, but you can get it. We only use the cpdf_set_ prefix once instead of multiple times (all these function names start with that prefix).

We need to make this prefix optimization automated if we would like to generate small files, so some PHP code can decide on what functions to add with this prefix trick. This does not mean that PHP will generate the JS on the fly. It can be generated on the rsync server to a static file. It will be updated if the function list changes.

Would someone have some motivation to look into this prefix optimization (or any other size decrease ideas for that matter)? I beleive we can significantly reduce the size of the JS this way.

Well spoted ! I'll have a look. We also need to set up some DHTML to allow ppl to pick up a function finded by the search engine. Any opinion regarding this part ?


I'm thinking of implementing a <div> above the text field that will be acceeded by arrow keys while typing the seeked function name. (like in a mailer for example when you start typing the recipient name).

Last version for reference:

[ http://lumumba.luc.ac.be/cheezy/misc/php/quickref_bs.html ]

It's buggy when you type z as first letter, I've warned Jan about that.



didou

Reply via email to