Why is firefox written in C ++ and javascript UI?

Well .. I am learning java now and am curious to know if this will bring a noticeable increase in performance? And if many developers follow a similar methodology for programming Windows (C ++ back end and Java UI) or other languages โ€‹โ€‹are used like python?

* this: C ++ back end and other languages โ€‹โ€‹for the user interface instead of using a different language to write the entire program.

+6
c ++ javascript firefox
source share
2 answers

Firstly, Java and JavaScript are completely different and unrelated languages. Firefox uses JavaScript; It doesnโ€™t use Java at all.

Secondly, this was not done for performance reasons, it was done to simplify writing add-ons and extensions that can be used with Firefox on any platform. C ++ code needs to be compiled, and after compiling it will only run on the platform for which it was compiled. JavaScript is an interpreted language that runs in an interpreter embedded in the browser, and therefore the same extensions can usually be run on MacOS, Linux, or Windows (or something else that Firefox works on).

And yes, there are other programs that use scripting languages โ€‹โ€‹for this kind of purpose (to simplify configuration and extension). For example, Civilization IV UI and game logic are written entirely with Python and XML for this reason, while high-performance graphics code is still in C ++.

+23
source share

This question really makes no sense unless you really ask if you should use your applications as XUL applications. Javascript alone does not give you any options for creating a user interface. A huge amount of code in Firefox is C ++ code that provides Javascript components with a user interface infrastructure.

+4
source share

All Articles