Re: [v8-users] ArrayBuffer fast access

2012-06-16 Thread Vyacheslav Egorov
> I couldn't find any fast access defined in the JIT compiler

There are fast paths for typed arrays inside V8, they are just not
called typed arrays :-) Look for "external arrays" instead.

For them V8 has both specialized IC stubs (e.g. load stub:
https://github.com/v8/v8/blob/master/src/ia32/stub-cache-ia32.cc#L3508
) and support in optimizing compiler pipeline (see IR instructions:
LoadExternalArrayPointer, LoadKeyedSpecializedArrayElement,
StoreKeyedSpecializedArrayElement).

I always use typed arrays when they are available (this communicates
my intent both to the JIT compiler and to a person reading my code).

--
Vyacheslav Egorov


On Sat, Jun 16, 2012 at 5:44 PM, Pablo Sole  wrote:
> Hello there,
>
> I'm embedding v8 into a binary instrumentation framework and I'm trying
> to use an ArrayBuffer/TypedBuffer for fast memory operations (like
> Tamarin/ActionScript does for the Memory object operations), but I
> couldn't find any fast access defined in the JIT compiler, so I suppose
> that a read/write to a TypedBuffer goes all the way of an object and
> property resolution. Although, for this case it could just be a range
> check and a memory load/store operation.
>
> So, would it be faster to use a regular array of SMIs (SMIs in the
> indexes and in the values) without holes faster than an ArrayBuffer? Is
> there any plan to provide a fast path for this case?
>
> Thanks,
>
> pablo.
>
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users

-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users


Re: [v8-users] ArrayBuffer fast access

2012-06-16 Thread Jakob Kummerow
Accessing TypedArrays is at least as fast as accessing regular JSArrays,
since they never contain holes and the optimizing compiler knows what types
to expect from their elements. Basically the recently introduced special
handling of SMI arrays without holes is an attempt to get them closer to
TypedArray performance.

Note that TypedArrays (a.k.a. "external arrays") are not defined in V8
itself. They are implemented by the embedder, e.g. the developer shell "d8"
or the WebKit V8 bindings. Look at these two examples for how to do that.


On Sat, Jun 16, 2012 at 5:44 PM, Pablo Sole  wrote:

> Hello there,
>
> I'm embedding v8 into a binary instrumentation framework and I'm trying
> to use an ArrayBuffer/TypedBuffer for fast memory operations (like
> Tamarin/ActionScript does for the Memory object operations), but I
> couldn't find any fast access defined in the JIT compiler, so I suppose
> that a read/write to a TypedBuffer goes all the way of an object and
> property resolution. Although, for this case it could just be a range
> check and a memory load/store operation.
>
> So, would it be faster to use a regular array of SMIs (SMIs in the
> indexes and in the values) without holes faster than an ArrayBuffer? Is
> there any plan to provide a fast path for this case?
>
> Thanks,
>
> pablo.
>
>

-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users

[v8-users] ArrayBuffer fast access

2012-06-16 Thread Pablo Sole
Hello there,

I'm embedding v8 into a binary instrumentation framework and I'm trying
to use an ArrayBuffer/TypedBuffer for fast memory operations (like
Tamarin/ActionScript does for the Memory object operations), but I
couldn't find any fast access defined in the JIT compiler, so I suppose
that a read/write to a TypedBuffer goes all the way of an object and
property resolution. Although, for this case it could just be a range
check and a memory load/store operation.

So, would it be faster to use a regular array of SMIs (SMIs in the
indexes and in the values) without holes faster than an ArrayBuffer? Is
there any plan to provide a fast path for this case?

Thanks,

pablo.

-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users