From 14144c391ffcc5e4f58f146976564df1aa8df32b Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Wed, 16 May 2018 03:02:58 +0300 Subject: [PATCH] ch3: fix typo in Object.setPrototypeOf() perf note Sync with the first sidebar paragraph and the source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf --- ch03.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch03.asciidoc b/ch03.asciidoc index 39e81d2..9d2bc8e 100644 --- a/ch03.asciidoc +++ b/ch03.asciidoc @@ -877,7 +877,7 @@ Using `Object.setPrototypeOf` to change the prototype of an object is an expensi [quote, Mozilla Developer Network] ____ -Changing the prototype of an object is, by the nature of how modern JavaScript engines optimize property accesses, a very slow operation, in every browser and JavaScript engine. The effects on performance of altering inheritance are subtle and far-flung, and are not limited to simply the time spent in a `obj.__proto__ = …` statement, but may extend to any code that has access to any object whose prototype has been altered. If you care about performance you should avoid setting the prototype of an object. Instead, create a new ((("objects", "built-in improvements", startref="ob3bii")))object with the desired ((("objects", "setting prototypes", startref="ob3sp")))((("Object.setPrototypeOf", startref="ospo3")))prototype using `Object.create()`. +Changing the prototype of an object is, by the nature of how modern JavaScript engines optimize property accesses, a very slow operation, in every browser and JavaScript engine. The effects on performance of altering inheritance are subtle and far-flung, and are not limited to simply the time spent in a `Object.setPrototypeOf(…)` statement, but may extend to any code that has access to any object whose prototype has been altered. If you care about performance you should avoid setting the prototype of an object. Instead, create a new ((("objects", "built-in improvements", startref="ob3bii")))object with the desired ((("objects", "setting prototypes", startref="ob3sp")))((("Object.setPrototypeOf", startref="ospo3")))prototype using `Object.create()`. ____ ****