JavaScript Performance JavaScript Performance

Deleting, Feeding Objects Exercise

Check out a free preview of the full JavaScript Performance course:
The "Deleting, Feeding Objects Exercise" Lesson is part of the full, JavaScript Performance course featured in this preview video. Here's what you'd learn in this lesson:

In this exercise, students delete properties to determine an impact on performance.

Get Unlimited Access Now

Transcript from the "Deleting, Feeding Objects Exercise" Lesson

>> Steve Kinney: What I want you to do is I'll actually freeze this code. And what I want you to do is I want you we're moving from the second dimension to the third dimension. When you make a third argument,
>> Steve Kinney: And we'll go ahead, we'll run some tests, we'll set each one of those, we'll set .x to undefined, run it, .y to undefined run it, .z to undefined, run it.

[00:00:30] Then we'll delete x, delete y, delete z, so we're gonna run six different tests,, and we're gonna look at when we see that big jump off, where it goes from 500 milliseconds to a full second. See if we can determine what are the cases where our code performs basically half as fast as it did in the other ones and see if we can make any kind of assumptions or generalizations about that.

[00:00:59] So let's take five minutes to try that out.
>> Speaker 2: You need to explicitly pass value for Z?
>> Steve Kinney: Yes.
>> Speaker 2: In the test?
>> Steve Kinney: You would also pass in some value in here as well.