Question/Suggestion about JS compilation



Maybe it's yet another my stupid idea, but following on C++ changes, I think 
this might be interesting (if it's really will work).

GNOME uses JavaScript and probably compiles JS code to native code. My 
suggestion is about:
1. Caching result of compilation
2. Take current user settings in mind, while compiling
3. Cache two version: with function invocation checking settings and with 
result of this function.

So - if user change settings, we will run one code and recompile in 
background, but if we have had compiled this code, we can use it. My question 
is: Will it be much faster?

How it would work? Add function check_setting(setting_gobject_path). We ran 
compilation twice or one time (depending we currently compile JavaScript 
code). First process, when find check_setting invocation, checks setting and 
pass result instead of this function, so JIT compiler will remove some code 
(because it will be never used). Second compilation isn't special, but 
compiles code normally. 

And some other idea. If we use something like this + some preprocessor, you 
can build base for many DE. Why not allows to compile GNOME with big range of 
options and without it? Why does not allow to be many variants of GNOME3? How? 
By allowing to preprocess JS files with setting some settings to specify 
value. If this preprocesor directive isn't set, preprocesor result would be 
check_setting invocation. Maybe kiosk mode?
-- 


Pozdrawiam,
Lach Sławomir.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]