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

  • SEARCH
  • Home
  • 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 8890133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:25:49+00:00 2026-06-14T22:25:49+00:00

After reading the recent smashing magazine article on optimisation, I ran some tests to

  • 0

After reading the recent smashing magazine article on optimisation, I ran some tests to see what would be the most effective way of “deleting” an element from the middle of one of my arrays.

After running my own tests regarding splicing a value out from the middle of the array vs deleting it/setting it to null, I came across the rather unexpected result that splicing the value out from the array made the array an order of magnitude faster to traverse.

More investigation led me to this.

For some reason, .shift()’ing the first record from the array made it 300 times faster to traverse (the biggest performance being seen in v8, but it seems to be valid for all the browsers I’ve tried it in).

I doubt I’ll abuse this as I don’t think the actual traversal is a bottleneck, but does anyone know why this behaviour occurs?

Edit: Incorrect use of jsPerf was the underlying issue here, see my answer below.

  • 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-06-14T22:25:51+00:00Added an answer on June 14, 2026 at 10:25 pm

    Okay, it turns out this is actually a misunderstanding on my part of how jsPerf works.

    The setup section of the script is something that’s run at the beginning of each set of loops rather than running it everytime it tries the script.

    As shown here the numbers actually turn out as you’d expect.

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

Sidebar

Related Questions

After reading this question, I need to clear up some things. IQueryable<Customer> custs =
After reading the Service Oriented Architecture Principles site and the respective Wikipedia article I
After reading several articles of a hierarchical data tables, I've made my way into
After reading this article, it makes sense to rebase to gather changes from the
After reading some stuff it seems I can map the SMBIOS memory and parse
After reading some statistics about my app I saw that it takes over one
I want a quick an easy way to check my ip address after reading
I've been tasked with handling some credit card data storage. After reading the PCI
After reading up on the JQGrid control, I decided it would be good to
After reading Jon Skeet article , and this article from msdn , I still

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.