I don't see why it's important to understand why things were slow two years
ago -- on the contrary, I'd call it a waste of time for both of us.

Frozen objects are a special case, special cases tend to be slower unless
someone decides to optimize them. Specifically, freezing an object used to
turn it into a slow (a.k.a. "dictionary") representation internally,
because only the slow representation was able to encode the fact that the
object was frozen.

Try not to have too specific performance expectations from JavaScript
implementations. It's a crazy language; there are frequent surprises in all
directions (slower than expected, faster than expected, behaves differently
than expected).

If you have ideas how to improve object handling, I'd be glad to review a
patch. Specifically, I'd be interested in how you envision making frozen
properties "slightly faster" than regular properties. (But no hand-wavy "in
an ideal world..." please, show me code.)


On Wed, Oct 15, 2014 at 4:12 PM, Thomas Bradford <[email protected]> wrote:

> Not sure if “don’t freeze objects” as punishment for using an older
> version of v8 solves the problem, especially if a person’s intent is to
> prohibit mutation.
>
> So back to my original question, because I think it’s important to
> understand.  Why *was* it 5+ times slower?  In the best case, reading a
> frozen property should be slightly faster.  In the worst case it should be
> exactly the same speed.  (Object.freeze, should only intercept writes in an
> ideal world).   Such a performance hit doesn’t make sense unless something
> horribly wrong was going on in the implementation.
>
> I’d just like to understand it.  I suppose I could look at the diffs, but
> that doesn’t explain why it was written the way it was to begin with.
>
> --
> Thomas Bradford
> @Kode4Food
>
> On 15 October 2014 at 15:32:46, Jakob Kummerow ([email protected])
> wrote:
>
> Well, as long as you're stuck with a version dating back to roughly the
> ice age, don't freeze your objects, problem solved.
>
> On Wed, Oct 15, 2014 at 2:36 PM, Thom Bradford <[email protected]> wrote:
>
>> Whatever is latest on Chris Lea's PPA
>>  On Oct 15, 2014 2:33 PM, "Jakob Kummerow" <[email protected]>
>> wrote:
>>
>>>  Works for me:
>>>
>>>  not frozen: 1061 ms
>>> frozen: 1054 ms
>>>
>>> There were some Object.freeze optimizations a couple of months ago.
>>> Maybe you're running a very old revision?
>>>
>>>
>>> On Wed, Oct 15, 2014 at 10:45 AM, <[email protected]> wrote:
>>>
>>>> I'm seeing this in Node, but can only assume it's V8 related.
>>>>
>>>> Can anyone explain to me why reading an Object's property is
>>>> considerably slower after calling Object.freeze against that object?
>>>>
>>>> It appears to be about 5+ times slower.
>>>>
>>>>  Thanks,
>>>> Thom
>>>>
>>>>
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to