Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5970613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:24:01+00:00 2026-05-22T20:24:01+00:00

The Benchmark: http://jsperf.com/substringing So, I’m starting up my very first HTML5 browser-based client-side project.

  • 0

The Benchmark: http://jsperf.com/substringing

So, I’m starting up my very first HTML5 browser-based client-side project. It’s going to have to parse very, very large text files into, essentially, an array or arrays of objects. I know how I’m going to go about coding it; my primary concern right now is getting the parser code as fast as I can get it, and my primary testbed is Chrome. However, while looking at the differences between substring methods (I haven’t touched JavaScript in a long, long time), I noticed that this benchmark was incredibly slow in Chrome compared to FireFox. Why?

My first assumption is that it has to do with the way FireFox’s JS engine would handle string objects, and that for FireFox this operation is simple pointer manipulation, while for Chrome it’s actually doing hard copies. But, I’m not sure why Chrome wouldn’t do pointer manipulation or why FireFox would. Anyone have some insight?

JSPerf appears to be throwing out my FireFox results, not displaying them on the BrowserScope. For me, I’m getting 9,568,203 ±1.44% Ops/sec on .substr() in FF4.

Edit: So I see a FF3.5 performance result down there actually below Chrome. So I decided to test my pointers hypothesis. This brought me to a 2nd revision of my Substrings test, which is doing 1,092,718±1.62% Ops/sec in FF4 versus 1,195±3.81% Ops/sec in Chrome, down to only 1000x faster, but still an inexplicable difference in performance.

A postscriptum: No, I’m not concerned one lick about Internet Explorer. I’m concerned about trying to improve my skills and getting to know this language on a deeper level.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:24:01+00:00Added an answer on May 22, 2026 at 8:24 pm

    In the case of Spidermonkey (the JS engine in Firefox), a substring() call just creates a new “dependent string”: a string object that stores a pointer to the thing it’s a substring off and the start and end offsets. This is precisely to make substring() fast, and is an obvious optimization given immutable strings.

    As for why V8 does not do that… A possibility is that V8 is trying to save space: in the dependent string setup if you hold on to the substring but forget the original string, the original string can’t get GCed because the substring is using part of its string data.

    In any case, I just looked at the V8 source, ans it looks like they just don’t do any sort of dependent strings at all; the comments don’t explain why they don’t, though.

    [Update, 12/2013]: A few months after I gave the above answer V8 added support for dependent strings, as Paul Draper points out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to this benchmark http://jsperf.com/function-vs-function created functions run about 1000 times faster. Can you
Has anyone used the Intel Math Kernel library http://software.intel.com/en-us/intel-mkl/ I am thinking of using
I've downloaded WIPmania's worldip table from http://www.wipmania.com/en/base/ -- the table has 3 fields and
I run a very simple php file on apache. Then I benchmark apache, using
http://en.wikipedia.org/wiki/Minimum_spanning_tree I'm looking to benchmark my minimum spanning tree algorithm against the best of
I tried to benchmark optimized string operations under http://lxr.linux.no/#linux+v2.6.38/arch/x86/lib/string_32.c and compare to regular strcpy:
I saw Java -server in http://shootout.alioth.debian.org/ for programming language benchmark. I know that -server
I just installed Ubuntu 10.10 server with NodeJS 0.4.6 using this guide: http://www.codediesel.com/linux/installing-node-js-on-ubuntu-10-04/ on
What benchmark would test how well my hardware rates, for my ASP.NET, SQL Server,
How do I benchmark the performance of my web applications? Is there a way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.