Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1C16710FFF for ; Wed, 18 Dec 2013 15:04:09 +0000 (UTC) Received: (qmail 74442 invoked by uid 500); 18 Dec 2013 15:02:38 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 74229 invoked by uid 500); 18 Dec 2013 15:02:24 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 73869 invoked by uid 99); 18 Dec 2013 15:01:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Dec 2013 15:01:52 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of agrieve@google.com designates 209.85.192.178 as permitted sender) Received: from [209.85.192.178] (HELO mail-pd0-f178.google.com) (209.85.192.178) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Dec 2013 15:01:48 +0000 Received: by mail-pd0-f178.google.com with SMTP id y10so8301617pdj.37 for ; Wed, 18 Dec 2013 07:01:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=NDpzpMtv9XpKHN4V0ylw7/arIZrt7UZ+IlttF8aEWUc=; b=AdtIuNhTE0wJbkAJWwAr1TM4TkU/Ycg8UhsvT77ALbU51bcfwwqoi/yXg6GIlDHnti 3SXkavePp2xLwZU7g0wv/2/EglD4TqXGEh6pljKje+vJgcQFnNRr8rJ28xKkx18bw3hL tHHhFsEfrHSbOvZdke4gPdYlxKRdPUbsExa7nWV8LDUfN3krxjThSZLT6qiUOM4LEQmU Gf/462gSE+PNRft2sTsw80LzeYeMjpKAloMygxO7J2r8d8xGzyA60AkDcRPXb09Aq1BX Y+KWVfxSc/i7yidq6mq+5IBY0IsGXAjN0UhkFc62dgEj0f2EbDNl+AV3G0iu/bZ95lrI JroA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=NDpzpMtv9XpKHN4V0ylw7/arIZrt7UZ+IlttF8aEWUc=; b=OwXRFroQFH0S6mnL0eOkBayWN8oXSjQbUYZVDcLvz1sOrKpu4jGnkcdksmvhEaTS52 CIJ865e7OJWskqVQEAB9t3mbRf252ImOocWq6eaTD4XdLiJhxXeI1ahJWp4NABIaWpbA BbZD5gbQRA+s2c4EJyQ7xIhBElHC/BaI/yrOc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:content-type; bh=NDpzpMtv9XpKHN4V0ylw7/arIZrt7UZ+IlttF8aEWUc=; b=PA6EDIBvc1OwkYZntEfTmbJWDXedPkUF9x6WUQJDKjSWwoc2tajEeZGHk1ECvJ7bbC D/WBBrjmGSDkTi1ieppZdss2QDQxuLIRomgnjLPqe6044Bm83m60ZHZEYg++mIUYI5PC htmHwZndAuU0tnFjvD9VVd07gAvWsO8n8aDiFjueWbSS4Sj7dhYVXLv0koY1qAlVsf01 EIIyYww1wshFNCyQGjaj3ICmoLJdC8OzNn1kc7PD7/PtWXyC+kGU919zTMFrYLn1uoTB 8PBXYwJY5t/9wJhfL3LxHPdZZmZ8NpWMdIYlcq5y3+blhjtaBFM1CzPSsNYEnkB0JI9g hbcg== X-Gm-Message-State: ALoCoQngAfCcfphS46CFtMcUOYpaV5LUvZpvpec+MPi8oi29MGRScPZpNc//FSW08WD6stsfDGkc0INvOcxVvlsnZms9gI5X+X+jv1mV+QvkvYJ0QGZYYVuS6+QcFi1An9TLpzBEJlNvPOJRTmGjNsDZeG8RtZY5rsPXvDsf+lojyUTGxhBIXSQIUaEGek6NwwrEQ3xAASnsXyZhuXu0orAOZFmZ1agmpA== X-Received: by 10.66.11.68 with SMTP id o4mr34546828pab.54.1387378887855; Wed, 18 Dec 2013 07:01:27 -0800 (PST) MIME-Version: 1.0 Sender: agrieve@google.com Received: by 10.68.136.35 with HTTP; Wed, 18 Dec 2013 07:01:07 -0800 (PST) In-Reply-To: <05cdf53f5d724b9e98f67a8b6f2f3804@BL2PR03MB417.namprd03.prod.outlook.com> References: <9bc28c5131fb4eb7a8eb4595902e8a06@BL2PR03MB338.namprd03.prod.outlook.com> <311af38e5ccb4e4b9e29237622d531f9@DM2PR03MB366.namprd03.prod.outlook.com> <5a192c7c5bcb4355a713f07bb2706211@BL2PR03MB417.namprd03.prod.outlook.com> <05cdf53f5d724b9e98f67a8b6f2f3804@BL2PR03MB417.namprd03.prod.outlook.com> From: Andrew Grieve Date: Wed, 18 Dec 2013 10:01:07 -0500 X-Google-Sender-Auth: dEEbD4WoSVBYdHh3QUJZZknEbGk Message-ID: Subject: Re: Windows Phone binary bridge To: dev , iclelland Content-Type: multipart/alternative; boundary=bcaec520e8f5c7c97904edd0519c X-Virus-Checked: Checked by ClamAV on apache.org --bcaec520e8f5c7c97904edd0519c Content-Type: text/plain; charset=UTF-8 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) < v-segreb@microsoft.com> 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: 'dev@cordova.apache.org' > 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: dev@cordova.apache.org > 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: iclelland@google.com [mailto:iclelland@google.com] On Behalf Of Ian > Clelland > Sent: Monday, December 9, 2013 9:06 PM > To: dev@cordova.apache.org > 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 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) < > > v-segreb@microsoft.com> 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: > > panarasi@microsoft.com] > > > Sent: Saturday, December 7, 2013 1:52 AM > > > To: dev@cordova.apache.org > > > 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:purplecabbage@gmail.com] > > > Sent: Friday, December 6, 2013 1:30 PM > > > To: dev@cordova.apache.org > > > 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 > > > > > >wrote: > > > > > > > On Fri, Dec 6, 2013 at 2:15 PM, Sergey Grebnov (Akvelon) < > > > > v-segreb@microsoft.com> 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: iclelland@google.com [mailto:iclelland@google.com] On > > > > > Behalf Of > > > > Ian > > > > > Clelland > > > > > Sent: Friday, December 6, 2013 7:37 PM > > > > > To: dev@cordova.apache.org > > > > > 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 > > > > > > > > > > > > > > > --bcaec520e8f5c7c97904edd0519c--