On Thu, Oct 6, 2016 at 12:50 PM, Rick Waldron wrote:
> var o = JSON.parse('{}');
> Object.setPrototypeOf(o, null);
That's not remotely correct, as it does nothing for anything other
than the top object. (And it breaks things if the top-level value
isn't an object.)
~TJ
_
var o = JSON.parse('{}');
Object.setPrototypeOf(o, null);
Rick
On Thu, Sep 29, 2016 at 9:30 PM Danielle McLean
wrote:
> From: Olivier Lalonde (mailto:olalo...@gmail.com)
> Date: 30 September 2016 at 07:21:10
>
> > Given that JSON.parse doesn't necessarily return an object, would the
> noProtot
From: Olivier Lalonde (mailto:olalo...@gmail.com)
Date: 30 September 2016 at 07:21:10
> Given that JSON.parse doesn't necessarily return an object, would the
> noPrototype option would be ignored on e.g. `JSON.parse('"some string"')` or
> `JSON.parse('true')`?
The noPrototype option should set
Given that JSON.parse doesn't necessarily return an object, would the
noPrototype option would be ignored on e.g. `JSON.parse('"some string"')`
or `JSON.parse('true')`?
On Wed, Sep 28, 2016 at 9:46 AM, 段垚 wrote:
> 在 2016/9/29 0:04, Michał Wadas 写道:
>
> Have you ever encountered performance issue
在 2016/9/29 0:04, Michał Wadas 写道:
Have you ever encountered performance issue because of copying object
on deserialization?
Not yet.
https://gist.github.com/Ginden/381448a17f50c7669b9a3693742e3a3d For me
results are:
Simple JSON.parse, 10 iterations: 39.5947526ms
JSON.parse wi
Have you ever encountered performance issue because of copying object on
deserialization?
https://gist.github.com/Ginden/381448a17f50c7669b9a3693742e3a3d For me
results are:
Simple JSON.parse, 10 iterations: 39.5947526ms
JSON.parse with copy, 10 iterations: 184.56997ms
JSO
在 2016/9/28 22:59, Danielle McLean 写道:
From: 段垚 (mailto:duan...@ustc.edu)
Date: 28 September 2016 at 16:36:52
[I]mplementors warn that mutating prototype causes "performance
hazards".
You don't actually need to mutate any prototypes to get prototypeless
objects out of `JSON.parse` - the reviv
From: 段垚 (mailto:duan...@ustc.edu)
Date: 28 September 2016 at 16:36:52
> [I]mplementors warn that mutating prototype causes "performance
> hazards".
You don't actually need to mutate any prototypes to get prototypeless
objects out of `JSON.parse` - the reviver function is allowed to
return a new
It is usually a bad practice to let a map-like object (an plain object
used as a key-value map) have a prototype.
Objects created by JSON.parse() have a prototype by default, and we can
get rid of them by:
JSON.parse(str, function(k, v) {
if (v && typeof v === 'object' && !Array.isArra
9 matches
Mail list logo