Nexus 7 2nd gen on kitkat.

On Thu, Apr 17, 2014 at 9:56 AM, Brian LeRoux <[email protected]> wrote:
> super interesting, what device were you testing w/ this?
>
>
> On Thu, Apr 17, 2014 at 9:56 AM, Andrew Grieve <[email protected]> wrote:
>>
>> Finally got to testing this out in Android's bridge. Strangely, it's
>> about 50% slower for 5k payloads. I tested this using the exec
>> benchmark in mobilespec, and a custom branch I just added to
>> cordova-js in case anyone else wants to give it a whirl. The page does
>> stay more responsive when doing it async, so we may want to switch to
>> this one day anyways, but for now I'm shelving.
>>
>> On Wed, Dec 18, 2013 at 7:01 AM, Andrew Grieve <[email protected]>
>> wrote:
>> > Neat! Just played with it in Chrome and FileReader certainly does seem
>> > faster.
>> >
>> > Ian's on a side project this week, but he spent a good amount of time
>> > figuring out the fastest way to do this conversion when he added that
>> > in, so
>> > I'm sure he'll have a look.
>> >
>> >
>> > On Wed, Dec 18, 2013 at 6:42 AM, Sergey Grebnov (Akvelon)
>> > <[email protected]> wrote:
>> >>
>> >> Does anyone see this interesting? Any real cases where it could be
>> >> important?
>> >>
>> >> Thx!
>> >> Sergey
>> >> -----Original Message-----
>> >> From: Sergey Grebnov (Akvelon)
>> >> Sent: Wednesday, December 11, 2013 8:33 PM
>> >> To: '[email protected]'
>> >> Subject: RE: Windows Phone binary bridge
>> >>
>> >> I've just compared ArrayBuffer to string conversion time via currently
>> >> used base64 method and via blob reading and the second one runs faster
>> >> (2-4
>> >> times on WP8 HTC 8S and 7-10 times faster on iPhone5; don't have
>> >> Android
>> >> device to test).
>> >>
>> >> So in case browser natively support FileReader and Blob api we may want
>> >> to
>> >> use that method.
>> >>
>> >> Here is test page I use
>> >> http://goo.gl/5mpjYu
>> >> http://sgrebnov.github.io/tmp/binPerfTest/www/js/index.js
>> >>
>> >> testBase64Str: function(data) {
>> >>          var defer = Q.defer();
>> >>         defer.resolve(base64.fromArrayBuffer(data));
>> >>
>> >>         return defer.promise;
>> >>     },
>> >>
>> >> testBlobReader: function(data) {
>> >>         var defer = Q.defer(),
>> >>             blob = new Blob([data]),
>> >>             reader = new FileReader();
>> >>
>> >>         reader.onloadend = function(e) {
>> >>             defer.resolve(e.target.result);
>> >>         }
>> >>         reader.readAsText(blob, "UTF-8");
>> >>         return defer.promise;
>> >>     },
>> >>
>> >>
>> >> Thx!
>> >> Sergey
>> >> -----Original Message-----
>> >> From: Sergey Grebnov (Akvelon)
>> >> Sent: Monday, December 9, 2013 9:36 PM
>> >> To: [email protected]
>> >> Subject: RE: Windows Phone binary bridge
>> >>
>> >> I see.. I've added similar logic to windows phone exec bridge
>> >> https://github.com/apache/cordova-js/pull/59
>> >>
>> >> Tested on File Api, below  is updated version after patching wp bridge
>> >> https://github.com/apache/cordova-plugin-file/pull/18
>> >>
>> >> PS. As showed at [1] manual array manipulation is not the fastest
>> >> solution
>> >> but it is the most convenient synchronous one
>> >>
>> >> [1]http://updates.html5rocks.com/2012/06/How-to-convert-ArrayBuffer-to-and-from-String
>> >>
>> >> Thx!
>> >> Sergey
>> >> -----Original Message-----
>> >> From: [email protected] [mailto:[email protected]] On Behalf Of
>> >> Ian
>> >> Clelland
>> >> Sent: Monday, December 9, 2013 9:06 PM
>> >> To: [email protected]
>> >> Subject: Re: Windows Phone binary bridge
>> >>
>> >> Yes, we used to use that; I had to switch it to use a base64-encoding
>> >> method; Using Array.prototype.apply() literally pushes every element of
>> >> the
>> >> array individually onto the stack as a separate argument. The exact
>> >> limit
>> >> depends on the device, but eventually they all fail with a "Stack
>> >> exploded"-sort-of-exception.
>> >>
>> >> Ian
>> >>
>> >>
>> >> On Mon, Dec 9, 2013 at 10:32 AM, Michal Mocny <[email protected]>
>> >> wrote:
>> >>
>> >> > Where do you see an implementation using Array.apply(null, new
>> >> > Uint8Array(...)) ?
>> >> >
>> >> > We used to have this bug in ios/android binary bridge but that was
>> >> > patched many releases ago (unless there is a stray one somewhere that
>> >> > still needs fixing).
>> >> >
>> >> >
>> >> > On Mon, Dec 9, 2013 at 10:15 AM, Sergey Grebnov (Akvelon) <
>> >> > [email protected]> wrote:
>> >> >
>> >> > > Working on this...I just found out that current implementation via
>> >> > > Array.apply(null, new Uint8Array(...)) doesn't work for big buffers
>> >> > (bigger
>> >> > > than 150Kb) and could raise Maximum call stack size exceeded error.
>> >> > > So
>> >> > I'm
>> >> > > looking on better/right way to do typed arrays conversion... will
>> >> > > keep
>> >> > you
>> >> > > updated.
>> >> > >
>> >> > > Thx!
>> >> > > Sergey
>> >> > > -----Original Message-----
>> >> > > From: Parashuram Narasimhan (MS OPEN TECH) [mailto:
>> >> > [email protected]]
>> >> > > Sent: Saturday, December 7, 2013 1:52 AM
>> >> > > To: [email protected]
>> >> > > Subject: RE: Windows Phone binary bridge
>> >> > >
>> >> > > I think Sergey should be able to squeeze this into his schedule. We
>> >> > > were looking at fixing plugin support and this could be a good way
>> >> > > to start
>> >> > it.
>> >> > >
>> >> > > -----Original Message-----
>> >> > > From: Jesse [mailto:[email protected]]
>> >> > > Sent: Friday, December 6, 2013 1:30 PM
>> >> > > To: [email protected]
>> >> > > Subject: Re: Windows Phone binary bridge
>> >> > >
>> >> > > FYI, you can buy a no contract Nokia 520 WP8 device for $120, and
>> >> > > developing in the emulator is more than sufficient for most tasks.
>> >> > >
>> >> > > Sergey, do you got this?
>> >> > >
>> >> > >
>> >> > > @purplecabbage
>> >> > > risingj.com
>> >> > >
>> >> > >
>> >> > > On Fri, Dec 6, 2013 at 11:21 AM, Ian Clelland
>> >> > > <[email protected]
>> >> > > >wrote:
>> >> > >
>> >> > > > On Fri, Dec 6, 2013 at 2:15 PM, Sergey Grebnov (Akvelon) <
>> >> > > > [email protected]> wrote:
>> >> > > >
>> >> > > > > Agree and  like this idea. I don't think there are many other
>> >> > > > > components (if any) which use ArrayBuffer but must be tested
>> >> > > > > well anyway since this changes core. Ian do you want to
>> >> > > > > complete
>> >> > > > > this yourself or you are ok if
>> >> > > > I
>> >> > > > > handle this?
>> >> > > > >
>> >> > > >
>> >> > > > I'm totally okay with you doing it -- I don't have a real windows
>> >> > > > phone device to test it on; I'd be committing with my eyes closed
>> >> > > > and hoping for the best :)
>> >> > > >
>> >> > > > I think you're right that there aren't any other core plugins
>> >> > > > using the binary bridge, but that could change, and there are
>> >> > > > probably already third-party plugins using it.
>> >> > > >
>> >> > > > If we do this right, then other developers won't have to roll
>> >> > > > their own solution in each case, and it will be easier to port
>> >> > > > the
>> >> > > > third-party plugins to WP.
>> >> > > >
>> >> > > > Let me know if you need any support; I'll help if I can.
>> >> > > >
>> >> > > > Ian
>> >> > > >
>> >> > > >
>> >> > > > >
>> >> > > > > -Sergey
>> >> > > > > -----Original Message-----
>> >> > > > > From: [email protected] [mailto:[email protected]] On
>> >> > > > > Behalf Of
>> >> > > > Ian
>> >> > > > > Clelland
>> >> > > > > Sent: Friday, December 6, 2013 7:37 PM
>> >> > > > > To: [email protected]
>> >> > > > > Subject: Windows Phone binary bridge
>> >> > > > >
>> >> > > > > As far as I can tell from reading its exec.js, WP8 does not
>> >> > > > > have
>> >> > > > > a binary bridge of any kind. Non-string data get
>> >> > > > > JSON-serialized
>> >> > > > > for
>> >> > > transfer.
>> >> > > > >
>> >> > > > > The recent patch for CB-5532 broke the File plugin by
>> >> > > > > explicitly
>> >> > > > > casting ArrayBuffer data to Array type. Sergey's fixed it now,
>> >> > > > > but the FileWriter JS code still has special cases for Windows
>> >> > > > > and WP8
>> >> > > platforms.
>> >> > > > >
>> >> > > > > Would it make sense to have this code moved into the WP8 exec
>> >> > > > > bridge?
>> >> > > > Then
>> >> > > > > it could apply to any plugins which transfer binary data, and
>> >> > > > > any
>> >> > > > improved
>> >> > > > > transport methods would automatically be used by all plugins,
>> >> > > > > rather than being a special case in each plugin.
>> >> > > > >
>> >> > > > > I don't know much about the Windows phone platform, so I could
>> >> > > > > be completely off-base about this, but if it works, I think
>> >> > > > > it'll make the implementation cleaner, and generally make
>> >> > > > > Cordova better on the
>> >> > > > platform.
>> >> > > > >
>> >> > > > > Ian
>> >> > > > >
>> >> > > >
>> >> > >
>> >> >
>> >
>> >
>
>

Reply via email to