Last Comment Bug 784746 - Contacts API: optimize debug statements
: Contacts API: optimize debug statements
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Device Interfaces (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla17
Assigned To: Gregor Wagner [:gwagner]
:
Mentors:
Depends on:
Blocks: 746439
  Show dependency treegraph
 
Reported: 2012-08-22 12:02 PDT by Gregor Wagner [:gwagner]
Modified: 2012-08-24 10:50 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
+


Attachments
patch (30.40 KB, patch)
2012-08-22 12:18 PDT, Gregor Wagner [:gwagner]
bent.mozilla: review+
Details | Diff | Splinter Review

Description Gregor Wagner [:gwagner] 2012-08-22 12:02:40 PDT

    
Comment 1 Gregor Wagner [:gwagner] 2012-08-22 12:14:14 PDT
Currently we create lots of garbage because we use 

let DEBUG = 0;
if (DEBUG)
  debug = function (s) { dump("-*- ContactManager: " + s + "\n"); }
else
  debug = function (s) {}

debug(...)

I want to change it to 
if (DEBUG) debug()
Comment 2 Gregor Wagner [:gwagner] 2012-08-22 12:18:42 PDT
Created attachment 654314 [details] [diff] [review]
patch
Comment 3 Chris Jones [:cjones] inactive; ni?/f?/r? if you need me 2012-08-22 12:20:25 PDT
Does the perf needle move with this patch?
Comment 4 Ben Turner (not reading bugmail, use the needinfo flag!) 2012-08-22 14:02:31 PDT
Comment on attachment 654314 [details] [diff] [review]
patch

Review of attachment 654314 [details] [diff] [review]:
-----------------------------------------------------------------

rs=me!
Comment 5 Philipp von Weitershausen [:philikon] 2012-08-22 14:04:24 PDT
Comment on attachment 654314 [details] [diff] [review]
patch

Review of attachment 654314 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/contacts/ContactManager.js
@@ +4,5 @@
>  
>  "use strict";
>  
> +const DEBUG = false;
> +debug = function (s) { dump("-*- ContactManager: " + s + "\n"); }

Missing variable definition for `debug`. Either

  let debug = ...

or

  function debug(...) ...

(I suggest the latter.)
Comment 6 Gregor Wagner [:gwagner] 2012-08-22 14:38:34 PDT
Fixed the variable definition.

https://hg.mozilla.org/integration/mozilla-inbound/rev/3f340329e85b
Comment 7 Andreas Gal :gal 2012-08-22 14:42:12 PDT
What about comment 3?
Comment 8 Gregor Wagner [:gwagner] 2012-08-22 14:52:13 PDT
(In reply to Andreas Gal :gal from comment #7)
> What about comment 3?

500 contacts take now 1.5 sec with the UI Test -> Get all contacts.
So from 9sec to 1.5sec.
Comment 9 Ed Morley [:emorley] 2012-08-23 03:46:43 PDT
https://hg.mozilla.org/mozilla-central/rev/3f340329e85b

Note You need to log in before you can comment on or make changes to this bug.