Close
  • Latest News
  • Artificial Intelligence
  • Big Data and Analytics
  • Cloud
  • Networking
  • Cybersecurity
  • Applications
  • IT Management
  • Storage
  • Sponsored
  • Mobile
  • Small Business
  • Development
  • Database
  • Servers
  • Android
  • Apple
  • Innovation
  • Blogs
  • PC Hardware
  • Reviews
  • Search Engines
  • Virtualization
Read Down
Sign in
Close
Welcome!Log into your account
Forgot your password?
Read Down
Password recovery
Recover your password
Close
Search
Logo
Logo
  • Latest News
  • Artificial Intelligence
  • Big Data and Analytics
  • Cloud
  • Networking
  • Cybersecurity
  • Applications
  • IT Management
  • Storage
  • Sponsored
  • Mobile
  • Small Business
  • Development
  • Database
  • Servers
  • Android
  • Apple
  • Innovation
  • Blogs
  • PC Hardware
  • Reviews
  • Search Engines
  • Virtualization
More
    Home Development
    • Development
    • IT Management
    • Servers

    Mozilla Speeds Up JavaScript with TraceMonkey

    By
    Darryl K. Taft
    -
    August 25, 2008
    Share
    Facebook
    Twitter
    Linkedin

      The folks at Mozilla have souped up JavaScript with a new just-in-time compilation scheme in a project known as TraceMonkey, which boosts JavaScript performance as much as 22.5 times depending on which benchmarks and tests you use.

      Brendan Eich, chief technology officer at Mozilla, called the technology a game changer and said TraceMonkey moves the goal posts for JavaScript developers.

      Like other dynamic languages such as Ruby and Perl, JavaScript has suffered from issues of poor performance compared with statically typed languages. TraceMonkey helps overcome those performance issues. Mike Schroepfer, former vice president of engineering at Mozilla, who now works at Facebook, developed a demo to show how TraceMonkey improves JavaScript performance.

      Moreover, in a blog post, Eich said, “I’m extremely pleased to announce the launch of TraceMonkey, an evolution of Firefox’s SpiderMonkey JavaScript engine for Firefox 3.1 that uses a new kind of Just-In-Time (JIT) compiler to boost JS performance by an order of magnitude or more.”

      In an interview with eWEEK, Eich said Mozilla began work on TraceMonkey just over 60 days ago with the help of Andreas Gal of the University of California, Irvine. And TraceMonkey is slated for inclusion in Firefox 3.1, Eich said.

      In a post on Ajaxian.com, Ben Galbraith, co-founder of Ajaxian, said:

      ““For years, many of us have been salivating over the idea of JIT’ed JavaScript in the browser. Adobe’s JIT’ing Flash VM [virtual machine] showed a preview of tremendous speed gains to be had, but we’ve had to wait until SquirrelFish from WebKit to see anything dramatic happen in the browser. Until now.”“

      “A fantastic new improvement to Mozilla’s JavaScript engine has landed. Code-named TraceMonkey, this engine utilizes a technique, called trace trees, which adds just-in-time native code compilation to SpiderMonkey,” said John Resig, a Mozilla evangelist and creator of jQuery JavaScript library.

      Speedy Performance

      “A major goal of the project has been to set JavaScript up to compete with natively compiled code, rather than simply against other interpreters,” said Resig. “This means that we’re starting to see speeds that are completely out of this league when it comes to performance.”

      Added Eich, “We’re supporting a bunch of platforms out of the box, including ARM, so we’re supporting mobile Firefox.”

      In a section of his post describing “What it all means,” Eich said:

      ““We have, right now, x86, x86-64, and ARM support in TraceMonkey. This means we are ready for mobile and desktop target platforms out of the box.As the performance keeps going up, people will write and transport code that was -too slow’ to run in the browser as JS. This means the web can accommodate workloads that right now require a proprietary plug-in.As we trace more of the DOM and our other native code, we increase the memory-safe code base that must be trusted not to have an exploitable bug.Tracing follows only the hot paths, and builds a trace-tree cache. Cold code never gets traced or JITted, avoiding the memory bloat that whole-method JITs incur. Tracing is mobile-friendly.JS-driven <canvas> rendering, with toolkits, scene graphs, game logic, etc. all in JS, are one wave of the future that is about to crest.”“

      Moreover, Eich said, “TraceMonkey advances us toward the Mozilla 2 future where even more Firefox code is written in JS. Firefox gets faster and safer as this process unfolds.”

      Mike Shaver, vice president of engineering at Mozilla, said of the TraceMonkey results:

      ““These are the early results from a project we’ve been calling TraceMonkey, which adds native code compilation to Mozilla’s JavaScript engine (-SpiderMonkey’). Based on a technique developed at UC Irvine called -trace trees,’ and building on code and ideas shared with the Tamarin Tracing project, a few of us have spent the last 2 months (and most of the last few nights) teaching SpiderMonkey some exciting new tricks.”“

      The goal of the TraceMonkey project-which is still in its early stages-is to take JavaScript performance to another level, where instead of competing against other interpreters, we start to compete against native code.”

      Describing the concept of tracing, Resig wrote:

      ““In simple terms tracing works by watching for commonly-repeated actions (such as loops, function calls, or type checking) and tries to optimize their resulting native code into the lowest number of actions. The premise is rather simple-and it’s an advance that we’ll probably see proliferate to many interpreters and engines in the upcoming years.”“

      “You record the instructions the interpreter is executing, like a VCR,” Eich said.

      “We’re looking at putting this [tracing JIT] into our native C++ DOM [Document Object Model] code base,” Eich told eWEEK. “We’re going to make our DOM traceable. We’ll move a lot of our code into JavaScript.”

      With the performance enhancements afforded by TraceMonkey, developers can start transporting code from other languages and other platforms and porting it to the browser, Eich said. “This moves the goal posts on proprietary plug-ins,” he said. “JavaScript with TraceMonkey will be so fast people can do ports of games.”

      Opening New Opportunities

      Eich also noted that this TraceMonkey news is “only a start. With tracing, performance will keep going up. We have easy small linear speedup tasks remaining (better register allocation, spill reduction around built-in calls). We will trace string and regular expression code. … We will even trace into DOM methods. The tracing JIT approach scales as you move more code into JS, or otherwise into view of the tracing machinery.”

      So what does this all mean, you might ask? Well, Resig asked the same question and answered it:

      ““It means that JavaScript is no longer confined by the previously challenging resource of processing power. With this improvement it’s leapfrogged any sort of traditional and has gone head-to-head with computationally powerful languages like C.”“

      Resig also said he expects to see “more, massive projects being written in JavaScript,” including projects that expect the performance gains that we’re starting to see, such as “applications that are number-heavy [like image manipulation] or object-heavy [like relational object structures].”

      For his part, Resig said he is especially interested in how TraceMonkey will impact development using Canvas. Canvas is an HTML element that can be used to draw graphics using scripting, typically with JavaScript.

      “The primary thing holding back most extensive Canvas development hasn’t been rendering-but the processor limitations of the language: performing the challenging mathematical operations related to vectors, matrices or collision detection,” Resig said. “I expect this area to absolutely explode after the release of Firefox 3.1 as we start to see this work take hold.”

      Eich said he expects other browsers to follow suit and begin to use JIT compilation for JavaScript.

      “I believe that other browsers will follow our lead and take JavaScript performance through current interpreter speed barriers, using just-in-time native code compilation,” Eich said. “Beyond what TraceMonkey means for Firefox and other Mozilla projects, it heralds the JavaScript Lightspeed future we’ve all been anticipating. We are moving the goal posts and changing the game, for the benefit of all Web developers.”

      Darryl K. Taft
      Darryl K. Taft covers the development tools and developer-related issues beat from his office in Baltimore. He has more than 10 years of experience in the business and is always looking for the next scoop. Taft is a member of the Association for Computing Machinery (ACM) and was named 'one of the most active middleware reporters in the world' by The Middleware Co. He also has his own card in the 'Who's Who in Enterprise Java' deck.
      Get the Free Newsletter!
      Subscribe to Daily Tech Insider for top news, trends & analysis
      This email address is invalid.
      Get the Free Newsletter!
      Subscribe to Daily Tech Insider for top news, trends & analysis
      This email address is invalid.

      MOST POPULAR ARTICLES

      Latest News

      Zeus Kerravala on Networking: Multicloud, 5G, and...

      James Maguire - December 16, 2022 0
      I spoke with Zeus Kerravala, industry analyst at ZK Research, about the rapid changes in enterprise networking, as tech advances and digital transformation prompt...
      Read more
      Applications

      Datadog President Amit Agarwal on Trends in...

      James Maguire - November 11, 2022 0
      I spoke with Amit Agarwal, President of Datadog, about infrastructure observability, from current trends to key challenges to the future of this rapidly growing...
      Read more
      IT Management

      Intuit’s Nhung Ho on AI for the...

      James Maguire - May 13, 2022 0
      I spoke with Nhung Ho, Vice President of AI at Intuit, about adoption of AI in the small and medium-sized business market, and how...
      Read more
      Cloud

      IGEL CEO Jed Ayres on Edge and...

      James Maguire - June 14, 2022 0
      I spoke with Jed Ayres, CEO of IGEL, about the endpoint sector, and an open source OS for the cloud; we also spoke about...
      Read more
      Applications

      Kyndryl’s Nicolas Sekkaki on Handling AI and...

      James Maguire - November 9, 2022 0
      I spoke with Nicolas Sekkaki, Group Practice Leader for Applications, Data and AI at Kyndryl, about how companies can boost both their AI and...
      Read more
      Logo

      eWeek has the latest technology news and analysis, buying guides, and product reviews for IT professionals and technology buyers. The site’s focus is on innovative solutions and covering in-depth technical content. eWeek stays on the cutting edge of technology news and IT trends through interviews and expert analysis. Gain insight from top innovators and thought leaders in the fields of IT, business, enterprise software, startups, and more.

      Facebook
      Linkedin
      RSS
      Twitter
      Youtube

      Advertisers

      Advertise with TechnologyAdvice on eWeek and our other IT-focused platforms.

      Advertise with Us

      Menu

      • About eWeek
      • Subscribe to our Newsletter
      • Latest News

      Our Brands

      • Privacy Policy
      • Terms
      • About
      • Contact
      • Advertise
      • Sitemap
      • California – Do Not Sell My Information

      Property of TechnologyAdvice.
      © 2022 TechnologyAdvice. All Rights Reserved

      Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.

      ×