Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Well..I am learning java now and I am curious to know will this yield a noticeable performance increase ? And If many developers are following similar methodology for windows programming ( C++ back end and Java UI ) or other languages are used like python?

*this : C++ back end and other languages for UI instead of using the other language to write the whole program .

like image 670
Ahmed Avatar asked Sep 27 '10 18:09

Ahmed


People also ask

Is Firefox written in C++?

In fact, a Mozilla browser distribution consists of both compiled C++ and uncompiled JS files. Note that JavaScript can not be compiled to be executed by the operating system directly, we still use C/C++ for the back-end of the program, JavaScript runs inside Mozilla.

What programming language was Firefox made in?

All modern web browsers - Internet Explorer, Firefox, Chrome, Opera, and Safari - have a core rendering engine written in C++. This language choice was made because it affords the systems programmer complete control of the underlying hardware features and memory in use, and it provides a transparent compilation model.

Why most of the Web browsers are written in C++? Give only reasons?

Basically, there really werent any other choices other than C++ that would allow one to build a browser that would be fast and run on many different platforms. So why were they written in C++? Because that was the only language available that they could be written in.

Why is JavaScript similar to C?

JavaScript and C share a somewhat similar syntax – this includes the clunky for statements and curly braces. Such features make JavaScript appear as an ordinary procedural language. However, the truth is; JavaScript is more of a functional language with more similarities to Scheme or Lisp than with C.


1 Answers

Firstly, Java and JavaScript are completely different and unrelated languages. Firefox uses JavaScript; it does not use Java at all.

Secondly, this was not done for performance reasons, it was done to make it simpler to write add-ons and extensions that can be used with Firefox on any platform. C++ code needs to be compiled, and once compiled will only run on the platform that it was compiled for. JavaScript is an interpreted language which runs in an interpreter embedded in the browser, and so the same extensions can generally run on MacOS, Linux, or Windows (or anything else that Firefox runs on).

And yes, there are other programs that use scripting languages for this sort of purpose (to allow easy customization and extension). For example, Civilization IV's UI and game logic is written entirely with Python and XML for this reason, while the performance-intensive graphics code is still in C++.

like image 79
Tyler McHenry Avatar answered Nov 08 '22 01:11

Tyler McHenry