473,788 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript implementation


What is the shortest and simplest Javascript implementation and where can I
find a BNF for this language?

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
Sep 20 '08 #1
10 2223
Jon Harrop <jo*@ffconsulta ncy.comwrites:
What is the shortest and simplest Javascript implementation and where can I
find a BNF for this language?
Shortest and simplest .. no idea.
Try looking at any of:
http://www.mozilla.org/js/spidermonkey/
http://www.mozilla.org/rhino/
http://webkit.org/projects/javascript/
http://code.google.com/p/v8/
and determine for yourself which is shortest or simplest.

The BNF is in the ECMAScript standard:
http://www.mozilla.org/js/language/E262-3.pdf

Enjoy
/L
--
Lasse Reichstein Nielsen
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Sep 21 '08 #2
Lasse Reichstein Nielsen wrote:
Jon Harrop <jo*@ffconsulta ncy.comwrites:
>What is the shortest and simplest Javascript implementation and where can
I find a BNF for this language?

Shortest and simplest .. no idea.
Thanks for the links. Here are my findings:
Try looking at any of:
http://www.mozilla.org/js/spidermonkey/
SpiderMonkey is a JavaScript interpreter written in 100kLOC of C.
http://www.mozilla.org/rhino/
Rhino is is a JavaScript interpreter written in 41kLOC of Java.
http://webkit.org/projects/javascript/
Webkit's JavaScriptCore is is a JavaScript interpreter written in 68kLOC of
C++.
http://code.google.com/p/v8/
Google's V8 is a native code JavaScript compiler written in 77kLOC of C++.
and determine for yourself which is shortest or simplest.
Google provide a Javascript benchmark suite with V8 that I had some fun
playing with. Konqueror's Javascript implementation gets a score of 12,
Microsoft IE 7 gets 20, Mozilla Firefox gets 120 and V8 gets a whopping
1,270!
The BNF is in the ECMAScript standard:
http://www.mozilla.org/js/language/E262-3.pdf
Thanks!

May I ask, do many people find JavaScript performance to be important? I
certainly wish my browsers were faster (more Konqueror and Mozilla rather
than MSIE) but I am not sure that can be attributed to the JavaScript
implementation. ..

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
Sep 21 '08 #3
Jon Harrop wrote:
Google provide a Javascript benchmark suite with V8 that I had some fun
playing with. Konqueror's Javascript implementation gets a score of 12,
Microsoft IE 7 gets 20, Mozilla Firefox gets 120 and V8 gets a whopping
1,270!
Unsurprisingly, as we discussed before, those benchmark results are flawed.
>The BNF is in the ECMAScript standard:
http://www.mozilla.org/js/language/E262-3.pdf

[...]
May I ask, do many people find JavaScript performance to be important?
That is a pointless question.

I would presume *competent developers* regard the performance of their
applications to be important.
I certainly wish my browsers were faster (more Konqueror and Mozilla rather
than MSIE) but I am not sure that can be attributed to the JavaScript
implementation. ..
Probably the rendering speed of the user agent's layout engine is more
important than the speed of the script engine as the former determines how
fast script operations manifest themselves. That does not mean, though,
that the efficiency of script code is unimportant.

The term "JavaScript implementation" is a misnomer, BTW. If anything,
Netscape/Mozilla.org JavaScript, Microsoft JScript & Co. are *ECMAScript*
implementations .
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.
Sep 21 '08 #4
Thomas 'PointedEars' Lahn wrote:
Jon Harrop wrote:
>Google provide a Javascript benchmark suite with V8 that I had some fun
playing with. Konqueror's Javascript implementation gets a score of 12,
Microsoft IE 7 gets 20, Mozilla Firefox gets 120 and V8 gets a whopping
1,270!

Unsurprisingly, as we discussed before, those benchmark results are
flawed.
Do you mean this thread:

http://groups.google.com/group/comp....b0b7218749f790

Or is there a more thorough discussion?
>>The BNF is in the ECMAScript standard:
http://www.mozilla.org/js/language/E262-3.pdf

[...]
May I ask, do many people find JavaScript performance to be important?

That is a pointless question.
Let me rephrase: would a more performant ECMAScript implementation be of
much interest or value?
>I certainly wish my browsers were faster (more Konqueror and Mozilla
rather than MSIE) but I am not sure that can be attributed to the
JavaScript implementation. ..

Probably the rendering speed of the user agent's layout engine is more
important than the speed of the script engine as the former determines how
fast script operations manifest themselves. That does not mean, though,
that the efficiency of script code is unimportant.
That's what I thought.
The term "JavaScript implementation" is a misnomer, BTW. If anything,
Netscape/Mozilla.org JavaScript, Microsoft JScript & Co. are *ECMAScript*
implementations .
Thanks.

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?u
Sep 21 '08 #5
Jon Harrop wrote:
Thomas 'PointedEars' Lahn wrote:
>Jon Harrop wrote:
>>Google provide a Javascript benchmark suite with V8 that I had some fun
playing with. Konqueror's Javascript implementation gets a score of 12,
Microsoft IE 7 gets 20, Mozilla Firefox gets 120 and V8 gets a whopping
1,270!
Unsurprisingly , as we discussed before, those benchmark results are
flawed.

Do you mean this thread:

http://groups.google.com/group/comp....b0b7218749f790
Yes.
Or is there a more thorough discussion?
None that I know of.
>>>The BNF is in the ECMAScript standard:
http://www.mozilla.org/js/language/E262-3.pdf
[...]
May I ask, do many people find JavaScript performance to be important?
That is a pointless question.

Let me rephrase: would a more performant ECMAScript implementation be of
much interest or value?
My Magic 8-Ball says: "Most likely".
HTH

PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Sep 21 '08 #6
On Sep 21, 4:55 pm, Jon Harrop <j...@ffconsult ancy.comwrote:
>
Google provides a Javascript benchmark suite with V8 that I had some fun
playing with. Konqueror's Javascript implementation gets a score of 12,
Microsoft IE 7 gets 20, Mozilla Firefox gets 120 and V8 gets a whopping
1,270!
The latest Webkit with SFX scores almost 6x better: in my Mac: before:
186 (Safari 312), now 1086 (Wewbkit r36712), Chrome/V8: 2665.

John resig has setup another benchmark suite: http://dromaeo.com.
>
May I ask, do many people find JavaScript performance to be important? I
certainly wish my browsers were faster (more Konqueror and Mozilla rather
than MSIE) but I am not sure that can be attributed to the JavaScript
implementation. ..
It depends: how much time does your page spend running JS code ?

A page with no JS: nothing.
A page that computes DNA regexps: a lot.
A page that expends 50% of the time computing, and 50% of the time
manipulating/rearranging the DOM (laying out/rendering): a 100%
improvement in JS peformance (2x JS speedud), would speed it up by
25%...

The rendering/layout engine performance is a factor, the other one is
the JS interpreter's. Oh, well, and the network speed as well...hehe.
Isn't it ?

--
Jorge.
Sep 21 '08 #7
Jorge wrote:
On Sep 21, 4:55 pm, Jon Harrop <j...@ffconsult ancy.comwrote:
....
>May I ask, do many people find JavaScript performance to be
important? I certainly wish my browsers were faster (more Konqueror
and Mozilla rather than MSIE) but I am not sure that can be
attributed to the JavaScript implementation. ..

It depends: how much time does your page spend running JS code ?

A page with no JS: nothing.
A page that computes DNA regexps: a lot.
A page that expends 50% of the time computing, and 50% of the time
manipulating/rearranging the DOM (laying out/rendering): a 100%
improvement in JS peformance (2x JS speedud), would speed it up by
25%...

The rendering/layout engine performance is a factor, the other one is
the JS interpreter's. Oh, well, and the network speed as well...hehe.
Isn't it ?
Good summary. I am interested in js-performance, but I am writing
js-programs for the general public. Users have their browsers already,
and persuading them to switch to another browser to get speed is not an
option.

I was astonished to see that the most simple js-statements are very fast
even in
old computers: even 1 000 000 lines per second. But as soon as
any DOM-manipulation are done, statements slow down 10 or 100 times.

The talk about 'performance' or 'efficiency' is sometimes very amusing:
a person might try to save with special coding one microsecond
(= 0.000 001 seconds) per page loading , but does not think
about using milliseconds (=0.001 s) or even
hundreds of milliseconds elsewhere on the same page.

If the page loading takes 5 000 000 microseconds, is there any sense
to write about saving 1 microsecond?

Sep 22 '08 #8
"optimistx" <op************ *@poistahotmail .comwrites:
If the page loading takes 5 000 000 microseconds, is there any sense
to write about saving 1 microsecond?
As with all optimizations: Don't do it, until you have determined (by
profiling) that it is going to help.

Most of your code is not critical to performance. E.g., anything not
inside a loop is unlikely to be important.

"More computing sins are committed in the name of efficiency (without
necessarily achieving it) than for any other single reason - including
blind stupidity." - W.A. Wulf

/L
--
Lasse Reichstein Nielsen
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Sep 22 '08 #9
On Sep 22, 4:24*am, "optimistx" <optimistxPoi.. .@poistahotmail .com>
wrote:
If the page loading takes 5 000 000 microseconds, is there any sense
to write about saving 1 microsecond?
That depends what you mean by page loading. Technically, I suppose
that it would mean all javascript and html executed before the onload
event. This would include such considerations as download speed of
images and include files which are certainly beyond the help of the
javascript engine.

If, on the other hand, you mean javascript setup code that executes
after the onload, then the efficiency of your javascript engine
becomes very important. I have been doing benchmarking of IE 8 Beta
2. In the area of pure string concatenation, I have measured a 50x
speed up. This is a very big deal to some folks with lots of legacy
code. I could rewrite that code to use temporary arrays and join and
I'd get my own speed-up but not close to 50x.

To the user, it all looks like "loading" time and in my case, the
difference is between 3 minutes and something under 20 seconds. And
before the anti-IE forces attack, the nature of the company and site
(private) is all IE, all the time, ActiveX required, nothing I can do
about it so don't start.

Bob
Sep 22 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
2840
by: John Bentley | last post by:
Note this is crossposted to comp.lang.javacript and microsoft.public.dotnet.scripting. After some Googling and FAQing my understanding of these terms is, crudely: Javascript (3 different definitions): 1. The scripting language originally developed by Netscape. (I offer a Brief handle: "Original Netscape Script") 2. The current implementation of the ECMAscript 262 (3rd ed.) standard by Netscape. (I offer a brief handle: "Current...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.