Firefox 18 Beta Out With IonMonkey JavaScript Engine
An anonymous reader writes with a quick bite from The Next Web about the latest Firefox beta, this time featuring some under-the-hood improvements: "Mozilla on Monday announced the release of Firefox 18 beta for Windows, Mac, and Linux. You can download it now from Mozilla.org/Firefox/Beta. The biggest addition in this update is significant JavaScript improvements, courtesy of Mozilla's new JavaScript JIT compiler called IonMonkey. The company promises the performance bump should be noticeable whenever Firefox is displaying Web apps, games, and other JavaScript-heavy pages."
Heh, subject says it all.
Also, first post?
None of these improvements feel any faster. Pages still load as quickly as they did a decade ago (provided your connection was fast). Why can't they make anything render faster?
Only the State obtains its revenue by coercion. - Murray Rothbard
I found it remarkable that the benchmarks only compared to earlier versions of the Firefox JavaScript implementation. A comparison with JavaScriptCore and v8 can be found at http://arewefastyet.com
still causing slowdown and frustration regardless of the speed in the javascript engine.
With Mozilla's frequency of spitting out new and newer versions, I just can't keep up!
No problem, just turn automatic updates on.
Signature has left the building.
Seems like every other browser release advertises massive javascript performance boosts via some new engine.
I haven't kept track with the JIT's that have been in Firefox. I recall the days when TraceMonkey and JagerMonkey were added to boost performance. Could somebody recap or tell why Firefox is abandoning the older versions or redoing them? I'm truly curious as to what they learned, what worked and what didn't work. Are they finding new usage patterns that warrant a new JIT design? Thanks.
Its good to see the focus of this release being an attempt to increase javascript speed by leaps and bounds. Modern webpages often use JS that goes way beyond anything people did 10 years ago (Jquery for example) and the complexities of what people do with javascript noticably slow down most webpages considerably.
http://interserver.net/
Can we get OpenGL based hardware accelerated rendering already?
Things are really, really, slow, and every single other browser on my system out performs firefox by a factor of 30 MINIMUM.
It's almost insufferable, scrolling's jerky and interactive graphs, like those on github, update less than once a second (and completely max out a CPU core whilst doing so).
Its good to see the focus of this release being an attempt to increase javascript speed by leaps and bounds. Modern webpages often use JS that goes way beyond anything people did 10 years ago (Jquery for example) and the complexities of what people do with javascript noticably slow down most webpages considerably.
When I first learned to program in BASIC, I used to think that people should try speeding up C and Assembly language -- Make EVERYTHING run faster... Then I learned C and x86 Assembly and I realized, you can't speed up assembly language -- It's a perfectly optimized language, there's nothing under the hood to tweak. You might select a better algorithm, or better use registers, but this isn't changing ASM. C can't really be hugely optimized either, it's pretty close to the metal, but there there are a few things one can do to increase performance in the space of its minimal abstractions; fewer with a mature compiler on mature hardware/platform...
I always wondered what the deal was with JavaScript too, "Wow, it's getting faster, AGAIN?" Then I created my own languages and compilers and I learned: A sign of a horribly designed language is that the speed of its implementations can be repeatedly increased "by leaps and bounds"...
/. is now a little bit more bearable.
It won't run on about 55% of the macs out there.
Maybe you're on the wrong release channel.
Oh, and because that's what the devs enjoy more.
They aren't being replaced. Each of these codenames is an additional optimization layer. The performance enhancements are cumulative.
Wikipedia goes into a bit of detail about it but in basic summary...
TraceMonkey was the first JIT compiler for SpiderMonkey released in Firefox 3.5.
JagerMonkey is a different design on TraceMonkey which outperforms it in certain circumstances (Some differences between TraceMonkey and JagerMonkey)
IonMonkey is another attempt at better perfecting the idea of JagerMonkey allowing even greater optimisations under particular circumstances.
However TraceMonkey, JagerMonkey and IonMonkey are part of SpiderMonkey as JIT compilers, not a replacement of SpiderMonkey itself.
Mozilla had the first JavaScript engine (SpiderMonkey) and the first JavaScript JIT (TraceMonkey), so it's not surprising that they've had more changes. Their development process is also much more transparent than that of other vendors, so their codenames get more visibility.
Bear in mind that Webkit's JavaScriptCore has had SquirrelFish and SquirrelFish Extreme JITs, Opera has had Futhark and Carakan, and even relative newcomer V8 has had a new Crankshaft JIT added. Mozilla is by no means the odd one out, optimising JavaScript is still a relatively young field and people are still working out the best way to do it.
The big difference with IonMonkey is that it adds an IR (intermediate representation) stage. That allows for much better and more modular optimizations at the cost of making compilation take significantly longer. The idea is that the JägerMonkey JIT has faster start-up time and will be used for not-as-long-running code while IonMonkey will be used to more heavily optimize very long running code.
Because SpiderMonkey had too much JagerMonkey and ran out of IonMonkey so couldn't finish TraceMonkey?
That's not quite true.
TraceMonkey has in fact been removed, and JaegerMonkey may be too once the new baseline JIT being worked on now is done.
I'm not so sure that the Javascript (well, EMCA Script) LANGUAGE is the problem. The challenges with respect to rendering speed have more to do with the DOM and the interaction with the browser itself. The DOM is a bulky beast. When javascript listeners are assigned to page elements the code can in turn alter the DOM creating or destroying elements, all of which can trigger javascript functions, any of which can create or destroy more DOM elements. It's a properly tangled mess. Memory management in this environment is no small task.
A short summary:
1) TraceMonkey turned out to have very uneven performance. This was partly because it type-specialized very aggressively, and partly because it didn't deal well with very branchy code due to trace-tree explosion. As a result, when it was good it was really good (for back then), but when it hit a case it didn't handle well it was awful. JaegerMonkey was added as a way to address these shortcomings by having a baseline compiler that handled most cases, reserving tracing for very hot type-specialized codepaths.
2) As work on JaegerMonkey progressed and as Brian Hackett's type inference system was being put in place, it turned out that JaegerMonkey + type inference could give performance similar to TraceMonkey, with somewhat less complexity than supporting both compilers on top of type inference. So when TI was enabled, TraceMonkey was switched off, and later removed from the tree. But keep in mind that JaegerMonkey was designed to be a baseline JIT: run fast, compile everything, no fancy optimizations.
3) IonMonkey exists to handle the cases TraceMonkey used to do well. It has a much slower compilation pass than JaegerMonkey, because it does more involved optimizations. So most code gets compiled with JaegerMonkey, and then particularly hot code is compiled with IonMonkey.
This is a common design for JIT systems, actually: a faster JIT that produces slower code and a slower JIT that produces faster code for the cases where it matters.
https://blog.mozilla.org/dmandelin/2011/04/22/mozilla-javascript-2011/ has a bit of discussion about some of this.
No problem, just turn automatic updates on.
Only works on systems where the user runs as admin / root. You don't do that, do you?
I don't understand why this comment got +5. It is pretty misguided.
The statement:
> I realized, you can't speed up assembly language -- It's a perfectly optimized language, there's nothing under the hood to tweak
makes some limited sense in some contexts (one could argue that the microcode supporting the assembler on the CPU is repeatedly optimized), but none in this. The IonMonkey JIT does essentially optimize the assembler code[*], by rearranging it in various ways to make it faster. E.g. it takes stuff like this (in javascript, as I have not written assembler in years):
for ( var i = 0; i != 10 ; ++ i ) {
var foo = "bar";
}
and changes it to e.g. this:
for ( var i = 0; i != 10; ++i ) {
}
var foo = "bar";
possibly then this:
var foo = "bar";
This is an optimization and it is performed at assembler level (Again: the above is not meant to be read as JavaScript, but assembler).
The other statement that really sticks out is this:
> A sign of a horribly designed language is that the speed of its implementations can be repeatedly increased "by leaps and bounds"...
This simply highlights that the poster really do not understand the goals behind crossplatform languages, such as Java, Dalvik, JavaScript, lisp, ML, Python, Perl, and so on, or the goals for weakly typed languages.
[*] It works on an abstract representation of the assembler code, but it might as well have been working directly on the assembler, was it not for the fact that this would require it to learn to many assembler variants.
because sometimes law enforcement doesn't know there are other browsers.
Good luck programming web content with C and ASM...
lynx renders..
09 F9 11 02 9D 74 E3 5B - D8 41 56 C5 63 56 88 C0 45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
The webmonkeys get hold of it. Do everything with it. They're ecstatic! Finally something that runs their javascript nice and fast!
So they throw more js into their webpages. Drop in a few more libraries, for their convenience. Of course, they're testing the stuff to the dev server that's at least as fast as the production server but sees only a small fraction of the load, and they have gigabit from desktop to server.
Thus, their websites become that much more crappy for everyone else, for everyone who doesn't have the lastest accellerator, or a nice and fast connection to an overspecced and mostly idle server.
It's happened before, it's happened again. Feh, if your desktop is old enough (single core, less than 2GHz these days) then between the crashes due to low memory you can actually notice when, say, jquery gets an update: Everything that uses it gets slower.
This is the state of websites, and as things stand, faster browsers mean slower websites for non-webmonkeys.
how is it horribly misguided, when you're one example proves his point.
that you cannot optimise the ASM layer, cause it's already directly on the cpu, but you can optimise the algorithm.
your example did just that and this optimisation is done FAR FAR above the assembly level.
I invite you to go read http://en.wikipedia.org/wiki/Program_optimization#.22Levels.22_of_optimization
And perhaps http://en.wikipedia.org/wiki/Tracing_just-in-time_compilation
As I said: The statement might make limited sense in some contexts, but not in this.
A sign of a horribly designed language is that the speed of its implementations can be repeatedly increased
The inability to optimize code is the sign of a horrible language, check out the large number of gcc optimization flags. Even then C Optimization hits some problems, pointer aliasing, one step compilation necessary for whole program optimization and close to the metal means more "do it this way" instead "this is what i want" and every developer should know that "this is what i want" gives more freedom to write a good implementation - asm is an extreme of "do it this way", optimization almost impossible. It has been a long time since humans where better at (large scale) low level optimization than compilers.
Actually, I shouldn't say that. Firefox started breaking on github around version 17.0. Many of the sub-project pages, e.g. Issues page and the Markdown - Raw viewer, redirect to a "Page did not load in a timely fashion" error page. This happens consistently on every github project. Unless the github team has done something weird on their end, this is another in the lengthy amount of compatibility problems Firefox is beginning to have.
Note that JavaScript is not a compiled, but an interpreted/JIT-compiled language. That is, the execution speed not only includes the execution speed of generated code, as in the case of compiled languages, but also the time of compilation/interpretation. That is, to have a meaningful comparison, you would have to compare to the time it takes to compile and run your C program.
Of course you could question the very concept of sending source code to the client, instead of sending something compiled to bytecode. But that's a completely different question; it has to do with how JavaScript is deployed, not how the language is defined. In principle it would be no problem to define bytecode for JavaScript, implement it in the browsers, compile the JavaScript to bytecode before putting it on the server, and send the bytecode to the browser. Of course if only one browser vendor did that, it would not be very useful. Even worse, if every browser vendor defined a different bytecode. So such a feature would only make sense if it were standardized.
You have this mostly backwards: being able to increase the speed of implementations is actually a good thing. Consider:
* x86 assembly implementation *has* increased by leaps and bounds, thanks to Intel and AMD. And that's a very good thing (which isn't only down to process technology).
* HTML video performance has increased leaps and bounds (mainly by offloading to GPU). Your hand-written x86-assembly video streaming code just won't perform on a mobile device. (I'm not sure your C program's layout code would always outperform webkit's general-purpose engine either, leaving aside the advantages of CSS/HTML over writing everything in C.)
* Your hand-written C parser probably parses slower than Perl does (you don't have the time to optimise your C code for that one-off sysadmin task).
* A SQL query stands a pretty good chance of performing better nowadays than writing your own storage implementation in C.
What I liked about the previous mozilla javascript engines was that they supported multithreading. That made them suitable for web-server use. In contrast with, for example Chrome's V8, which is not suitable for server use (unless you are prepared to spawn multiple processes instead of threads, but this is very expensive performance-wise of course).
So I hope they support multithreading.
If Pandora's box is destined to be opened, *I* want to be the one to open it.
Thank you for the comparison. Why can't web developers compile the javascript and provide that? I do understand that each runtime (browser) is unique, but why not have something along the lines of:
<script type="text/javascript" name="fooBar" compiled-for="firefox" src="firefox.js"></script>
<script type="text/javascript" name="fooBar" compiled-for="chrome" src="chrome.js"></script>
<script type="text/javascript" name="fooBar">
fooBar();
</script>
Thus the appropriate compiled code is presented to each runtime, and if there is no compiled code available for any particular runtime then the uncompiled code can be used. This is similar to how software is currently made available: binaries for the common platforms and source for the rest.
Of course I realize that MSN.com will have available only compiled code for IE, thus ostensibly 'killing' Firefox and Chrome performance. In fact, Firefox and Chrome performance will remain as it is, simple IE performance will be improved.
It is dangerous to be right when the government is wrong.
In retrospect, "text/javascript" for the first two items should be "bin/javascript".
It is dangerous to be right when the government is wrong.
its not like javascript were the problem of any current browser, but all of them work on improving the js engines instead of taking a break from the x-th js improvement and build a better browser ui. For example mozilla should fix stuff like menubar, favicon, statusbar, ... all the "we need to look like chrome" stuff. hey, if i want something which looks like chrome, i use chrome. If there weren't all the extension fixing this crap, maybe i would be a chrome user for a long time, since firefox gave up its own identity and started to clone chrome.
Then I learned C and x86 Assembly and I realized, you can't speed up assembly language -- It's a perfectly optimized language, there's nothing under the hood to tweak.
Well, not really. You can't optimize perfectly optimized assembly any further, but that's just tautology. You can optimize even quite well written assembly further, especially on modern CPUs with various selections of functional units, variable pipelines, multiple instruction dispatch per cycle, vectorising etc.
In fact, the days have generally passed where I can write better ASM that what gcc can output from a C/C++/Fortran program, because it has much better knowledge of the CPU internals and is generally better at doing things like register allocation etc.
In terms of Fortran, C99 and GNU's extensions to C++, it can even be told when pointers don't alias, so one of the final benefits of assembly has vanished. With good SSE scheduling and support from within higher level languages, the other main benefit of assembler has vanished.
It's now at the point where C++ is generally faster than assembler for all but the best of assembler programs and some very specific cases, for instance where it helps to have direct access to something like the CPU flags.
One reason is that the optimizers have got really, really good. They can even figure out when you're stepping through a 2D array in the wrong order can re order the loops. They are also excellent at removing redundancy which means you can write simpler code (and therefore write more advanced algorithms much more easily) without worrying about redundancy killing performance.
The optimizers are amazing and do an awful lot. This is why optimized code is more or less impossible to debug. Once it does passes of inline, partial redundancy emimination, loop unswitching, fusion, strip mining, dead code elimination, constant propagation, alias analysis, loop unrolling, modulo scheduling and register allocation, a given instruction probably doesn't correspond to any one line of code at all, so no stack trace is even possible.
And as for assembly, things aren't so simple there. Look at the difference between the faster clocking P4 and the much faster performing Ivy Bridge i7. The result of that is essentially that the i7 has an optimizer inside it which runs at 3.3 GHz and performs many of those steps real-time before actually farming out instructions for computation. IPC is all about optimizing assembler as much as possible.
Then I created my own languages and compilers and I learned: A sign of a horribly designed language is that the speed of its implementations can be repeatedly increased "by leaps and bounds"
It depends on what you mean "horribly designed". Many languages are designed to be easy for some particular task rather than maximal performance. It's hard to argue that Haskell is poorly designed, but optimization is a very tricky problem and performance has certainly increased greatly as optimization techniques have become well understood.
Even FORTRAN, which was specifically designed to be optimizable even given the non-existant state of the art at the time (optimizing compilers were essentially invented for FORTRAN) has seen significant improvements in the performance of the compilers.
C and C++ which were designed to be close to the metal and so not need much optimizing have also got much better with improved optimizers.
It seems that the key to a high performing language is to allow the user to tell the computer as much as possible about the program's intent, so that things can be proven and optimization can be performed.
SJW n. One who posts facts.
Web developers asking the browser to run binary code straight from the server surely sounds like a refreshing idea. I wonder if anyone have thought about it before...
I would prefer a more efficient lower level intermediate language, common to every browser that could be targeted by more languages.
People don't change browsers much if those I know are any indicator. When they do, it typically is because one or more of three events occurred. The first is when they're actively shown an alternative by a preacher. The next is when they compare a site in different browsers and notice a material difference, eg when designing it. The last is when intense frustration leads them to actively seek alternatives.
In my (non-representative) sample, FF has been hemorrhaging irate users for several years now. And the list of thinga that irritated them seems unending. So this feels like too little, too late.
Can we get OpenGL based hardware accelerated rendering already?
You should already have it :)
Tools > Preferences > Advanced > General > Browsing: "Use hardware acceleration when available"
I can't wait to see what kind of malware this type of scheme would produce. I have no proof, but if feels like running a compiled bytecode would be easier to exploit than text based javascript.
For fuck's sake - 5 layers deep of scripts? Six? More? No Script has become nearly useless when I have to turn on 5 or 6 LAYERS of scripts and 45 different scripts just to format a page. And on a good day they slow everything down to level of running it on a 486DX100 machine circa 1996.
Well, it would actually be a step back for usability for web developers. If you haven't tried an interpreted language, you probably don't understand why, but it does actually matter.
Also, I could be wrong, but I think state-of-the-art Javascript compilers don't actually spit out a binary, instead they sort of grow the program in place. The old separate-compilation idea makes some optimizations much harder compared to a JIT that can actually watch the whole program + libraries run.
This is especially true for a dynamic library like Javascript because most of the speed up comes from inferring the types, e.g. instead of representing [0, 1, 4] as an array with three objects, it can be allocated as int a[3], and the code can add the ints directly rather than having to unbox operand 1, unbox operand 2, add them, and box the result. Without some kind of help from the programmer, it's really, really hard to infer types automatically - so you basically have to watch the program run to see what types actually occur.
Do you have a source to back that up?
I'm personally under the impression that most pages are slow because of rendering speed, not because of Javascript execution itself. I see improvements in Javascript compilers mostly as an enabler of future tech, not something that significantly speeds up existing pages.
Of course, with a couple of big libraries, parsing time is perhaps important.
Good luck programming web content with C and ASM...
Where's the problem? All you need is an appropriate browser exploit. :-)
You _can_ speed up assembly language. Just as it's possible to write awful code in C/C++ and produce bad assembly from it so too can you just hand-code the same bad assembly yourself.
When you're hand-tweaking assembly or rolling the fastest code you can possibly go for you usually end up targeting a particular processor. Per example, if I have an algorithm that works on a fairly small amount of data but that data is spread out all over the place then I might compact it to fit efficiently in the Core i7 L1 data cache (so, pack it in around 32KB). Most x86 processors are going to have that cache so in general it's going to be a performance boost. Now if I need a bit more oomph and my data is bigger then I might shoot to get it into L3 and prime the cache to hide more latency. Then you have to worry about instruction-to-instruction latency and making sure you don't stall at any point. Then there's the nuances of the instruction set itself - I seem to remember Carmack making an integer math optimization in Quake to avoid messing around with the FPU state and stalling.
The advantage of working in higher level languages is that performance is bumpkins for the most part. The big outer loops of your GUI applications may execute a grand total of 100,000 times in the space of an hour which in processor terms is "barely ever". There's just no sense optimizing code like that aggressively since it makes porting your code to a new architecture so much harder. The things that make sense to optimize are the really high bandwidth operations like graphics and sound. A simple loop to copy some data into VRAM might seem like the best way to do things until you realize a BitBlt will get the job done faster so you change out your assembly. Both of these will probably blush when a typical GPU gets involved though but then you end up restructuring large parts of your code to handle image uploads and actually rasterize with parts of the 3D hardware. Again, your assembly is going to change here.
In general the more expressive the language is then the better the code you're going to get - more compact code runs faster (or at least 'could' run faster). The reason is simple: The less code you write, the more code someone else can handle, and they might handle it better and optimize it themselves if enough people are using it. JIT is the next evolution in this idea because the algorithms can now change wrt to data they are receiving. This is actually an old technique that falls under "Program Specialization". It remains to be seen how successful this becomes though - we don't have good algorithms for determining what a good algorithm should be for all possible data sets. We know some basic no-brainer transforms that are guaranteed to be a win though (like obvious constant folding).
./firefox ./firefox: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
bash:
Linux koala 3.6.6-1.fc16.x86_64 #1 SMP Mon Nov 5 16:56:43 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
I downloaded FF17 yesterday. It broke a couple of my plugins (naturally) and keeps locking up. I finally removed it and rolled back to FF16. I only used FF for testing code on my own sites, so I'm not overly worried about security patches. A friends and fellow web developer said he ended up re-writing a bunch of his CSS to get it to render properly in FF17 (FF16 worked fine). I am really disappointed with the latest release.
Why can't web developers compile the javascript and provide that?
The whole point of the web and the reason javascript has become what it has is because we can write things now as websites that once would have been native applications that only worked on a single platform. If we had to go to the effort of compiling the web application before shipping it we might as well use something like Java, C or C++ and then ship native applications with all the increased flexibility that provides.
Instead we now use websites for very complicated applications using AJAX interactions and such that are often hosted on intranets in order to keep latencies low. The main driver to this has been the cross platform support that the modern web provides for the end user. Even stand alone applications that require no interaction with anything outside themselves are often now shipped as web based apps if there are not IP issues to do with protecting the code (most of the time there is an issue with distributing the code which is why Java is so popular).
The biggest issue though is probably that if a browser vendor suggested an approach like you suggest they would be shooting themselves in the foot as it would increase the workload for each additional browser a web application needed to support far more than at present. If I had to produce a compiled version of the JS libraries for opera then there is no way I could justify that cost to management based on their browser share. It might even be that things like Opera and Firefox started falling off the supported list for many clients since they might be only interested in the corporate space where IE is still dominant. I think I could just about make a case for supporting Safari based for Macs but in other cases I would have to work impossibly hard too justify multiple browsers supported on a single platform when considering the increased costs for each.
I dont read
I can not recommend Ghostery enough. More pragmatic than NoScript.
It's been done. A lot.
http://www.linuxjournal.com/article/6863
http://www.boutell.com/cgic/
http://www.cs.tut.fi/~jkorpela/forms/cgic.html
Never heard of cgi?
Thank you for the comparison. Why can't web developers compile the javascript and provide that? I do understand that each runtime (browser) is unique...
...and that's the problem. The only way to do this well would be to have some sort of standardized bytecode that browsers could compile to, and there is no such standard at the moment. As long as each browser goes through its own intermediate formats, you'd have to have different builds for different browsers, and nobody would bother to maintain them properly.
I don't have to deal with this disgusting crap anymore.
The real problem is jquery itself. People won't even bother learning regular javascript, so jquery is required for all the crap they write.
And then they can't even be bothered to write their own code using jquery either and they download pre-made code that requires jquery to run, ending up with pre-written code calling jquery calling javascript.
All that for a fucking mouse-over effect with pre-loading of images that should have been done with CSS and sprites in the first place.
Get free satoshi (Bitcoin) and Dogecoins
Please stop using the obsolete text/javascript MIME type. The correct MIME type for JavaScript programs is application/ecmascript or application/javascript - see RFC 4329. It's best to not use any type attribute because it is optional in HTML5 and was never needed in practice but if you insist on using optional attributes then please at least use the correct values.
The problem is that as runtimes evolve the compiled format changes. Furthermore, the end result of the compilation depends on the exact processor being used by the user, and at least in SpiderMonkey on things like the location of the Window object in memory.
Not only that, but the final compiled version is unsafe machine code, so a browser couldn't trust a web page to provide it anyway.
So pages wouldn't be able to provide a final compiled version no matter what. They may be able to provide bytecode of some sort, but again the bytecode format browsers use is not fixed (assuming it exists at all; V8 doesn't have a bytecode) and compilation of JS to bytecode would have to be replaced by some sort of bytecode verifier for security reasons, so there may not even be much of a performance win from the switch.
that you cannot optimise the ASM layer
Not really
What is better mov eax,0 or xor eax,eax?
That depends on your CPU. You can swap out instructions that do the exact same thing yet yield you a few extra cycles. Your biggest 'bang for the buck' though is algorithm changes.
Also as most modern CPUs do they will execute out of order (up to 4 instructions!) to optimize the pipeline. If you know how the optimizer works you can even make it run faster by just changing the order of execution (with the same results, letting the optimizer idle more). They also have branch cache lookups in the CPU. Depending on which cpu you have something like if (x==y) (z = 0;) else (z=1;) could be slow or fast depending on how the branch optimizer looks at things and which instructions it speculatively runs. You can take advantage of that too in your code by just switching the logic around.
So yes you can 'optimize' the ASM layer. But it requires knowledge that is not worth applying unless you are writing very CPU specific code. However a JIT language could take advantage of it by 'pre-testing' and figuring out what sorts of ASM to emit.
That's what I've been reading, anyhow. My sources didn't specify if this would only be on OS X or also on other OSes which you might run on the same hardware.
Hail Eris, full of mischief...
E pluribus sanguinem
I have used ion monkey for quite some time - I was running nightly ion-monkey builds before it was merged into the 'regular' nightly code. The speed up is at best minimal from a user perception except on really heavy js sites. And if anyone from the dev team reads this, there is a dreadful memory leak in the latest 20s.
Except the company that bought Ghostery is an ad company and is tracking things through the add-on. Just make sure to require disabling GhostRank when you recommend the add-on.
> C can't really be hugely optimized either,
You've never worked on a C/C++ compiler have you? :-)
C most definitely can be sped up. Why do you think we even have the "restrict" keyword?
http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html
Function temperature provides hints to the compiler on what code should be inlined.
The back-end of a compiler has a lot of room for generating optimal code IF it understands the target hardware. i.e. Minimizing register spill is extremely important on x86 with its lack of GP registers, reordering instructions to minimize pipeline stalls, known when/where to issue read/write barriers, etc.
One of the major features / problems in C is that arrays = pointers. This is a MAJOR headache WRT to optimizations in a C compiler. In a "clean" language without pointers the compiler is able to strongly infer a lot of assertions; once you throw pointers in the mix the potential for optimizations goes right out the window since the compiler is no longer able to "pre-calculate" offsets.
The lack of strong type inference in C also limits its optimizations.
The LISP / Haskell guys don't have pointers and as such they force the burden on the compiler to "churn" through the type inference system in order to generate optimal code. This leads to a smaller, cleaner compiler, at the expense of a developer needing tons of RAM and CPU to just get the same level optimization a C compiler can do in half the time.
At the end of the day it is all about instruction ordering and caching. Keeping track at what time are what variables "live" and where.
Thank you. I'll look into that.
It is dangerous to be right when the government is wrong.
It looks like you are correct. Thank you! However, there are some details that are not clear, so I posted this question on StackExchange which might interest you:
http://stackoverflow.com/questions/13591069/why-use-application-javascript-as-opposed-to-text-javascript
Again, thank you.
It is dangerous to be right when the government is wrong.
Layers? What?
I mean, the SCRIPT tag does have a LANGUAGE= attribute doesn't it? Sure, there's the old chicken-and-egg argument, but if someone would at least put it out there, perhaps it could have a chance. Why does everyone consider it a foregone conclusion that javascript was, is, and ever-shall-be the language of browsers? Security isn't a valid argument -- there have been a ton of exploits that break out of the javascript sandbox.
Let's just put in a sandboxed VM with a built-in JIT compiler for C compiled to ARM assembler or something, and be done with it. Script kiddies could scribble over pointers as much as they want, but within the sandbox. Time has shown that the language isn't what gives security, it's the security of the sandbox itself that ensures a safe environment.
C makes 1970s assumptions like there will be only 1 thread (no parallelism), no such thing as SSE, and few built-ins (thus requiring a variety of libraries that may make similar errors). Modern technology offers C extensions (OpenMP), better libraries, better compilers which have utilize modern architecture targets. Even Java now auto-parallelizes some code that it once ran linearly. There is enormous potential for non-trivial code to better-fit the hardware.
Science & open-source build trust from peer review. Learn systems you can trust.
Oh, this isn't about advertisements?