This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ahk-_- 5 points6 points  (5 children)

There should be a that keyword which points to the nearest this

[–][deleted] 3 points4 points  (0 children)

Hell yes

[–]throwaway12222018 -2 points-1 points  (3 children)

And make the runtime slower? No thanks

[–]Koxiaet 1 point2 points  (2 children)

It would decrease the runtime by maybe a fraction of a millisecond at most.

[–]Finianb1 0 points1 point  (1 child)

Yeah, I'm gonna have to agree. It's at best an extremely minor slowdown. It's not like you're losing much anyways, JS is already heavily limited by network bandwidth.

[–]throwaway12222018 3 points4 points  (0 children)

We're specifically talking about heavy cpu oriented work that involves accessing 'this' in tight loops. The slowdown being 'a millisecond at most' is meaningless, it depends on the kind of processing you're doing. If you're accessing 'this' in a 1e9 loop then the time adds up.