You Got A Question? Ask    GNOME Community!


Shell Is Turned Into A Binary | Performance Optimizations [GNOME 3.12]

Shell in GNOME 3.12 has gained many performance optimizations, like the porting of Gjs to the latest SpiderMonkey engine, a better handling of thumbnails cache and others. The most important change towards to performance, starting from GNOME 3.12, is that Shell will be a single binary file. It is faster to load one file than many, because the kernel can read-ahead it, and you don’t need to load many inodes.

That made possible with #703440 and the ability of GJS to load JS from a GResource. Gnome-Shell-Extension-Prefs also turned into a binary.

Cossimo Cecchi. It would be nice for a gjs application to be able to bundle all of its JS files as a GResource, and having the launcher be an actual C executable.

It turns out this is very easy to implement, thanks to the transparent support of resource:/// files inside GIO. The following patch ports the way imported files are loaded in gjs to GIO, which gives us free support for setting a resource:///foo/bar/application search-path on a GjsContext from the C launcher.

Shell is now a binary linked against Mutter, instead of being a Mutter plugin loaded as a module.


What Changes for Users

Normal users will just enjoy the benefits in performance. This change doesn’t only affect GNOME Shell, but it can be used to any GJS App.

Notice that

/usr/share/gnome-shell/js

has been removed, so you can’t hack Shell directly from there anymore.

For Extension Developers

For extension developers doesn’t change anything, apart that they need to get Shell from Sources and compile it, so they can read, debug and override code.

For GJS Application Developers

GNOME JavaScript Application developers that want to take advantage of the performance, they have to see how Gnome-Weather and Gnome-Shell-Extension-Prefs do it.

Giovanni Campagna (GNOME Dev) also updated GTK-JS-App and GTK-App-Generator tools to use the above technique. You can get them from gcampax Github


 
  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • Pingback: Shell Is Turned Into A Binary | Performance Optimizations [GNOME 3.12] | Linux news

  • 42

    So I guess this finally combines the disadvantages of script and compiled languages? Neither easy to hack nor as fast as a C/Vala binary?
    I wonder how fast it could be in Vala. Modules could be supported, too. Not as flexible as the current extension system, but probably close to it if implemented right.

    • alex285

      Personally I can’t know that since I am not GNOME developer. But, I doubt if the language plays any role in performance nowadays, at least for higher lever development.

      Node community gives scripts in Javascript that run faster than C.

  • IsacDaavid

    Wasn’t rapid prototyping and monkey patching the reason they went with Javascript (in interpreted form) in the first place?

    I am using old and slow hardware, but I can’t really say this change thrills me