<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>19761</bug_id>
          
          <creation_ts>2012-10-29 19:39:40 +0000</creation_ts>
          <short_desc>Dictionary type for MIDIMessage is likely a performance issue</short_desc>
          <delta_ts>2012-11-19 16:03:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>AudioWG</product>
          <component>MIDI API</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>TBD</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Wilson">cwilso</reporter>
          <assigned_to name="Chris Wilson">cwilso</assigned_to>
          <cc>jussi.kalliokoski</cc>
    
    <cc>olivier.thereaux</cc>
          
          <qa_contact>public-audio</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>77318</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Wilson">cwilso</who>
    <bug_when>2012-10-29 19:39:40 +0000</bug_when>
    <thetext>MIDIMessage is currently defined as a dictionary.  In the case of thousands of MIDIMessages being pumped through the system, that would be less efficient than a type that can be explicitly typecast.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77482</commentid>
    <comment_count>1</comment_count>
    <who name="Jussi Kalliokoski">jussi.kalliokoski</who>
    <bug_when>2012-10-31 01:04:45 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; MIDIMessage is currently defined as a dictionary.  In the case of thousands
&gt; of MIDIMessages being pumped through the system, that would be less
&gt; efficient than a type that can be explicitly typecast.

I&apos;m not sure what you mean by a type that can be explicitly typecast, could you clarify? Do you mean using a constructed type instead, like `new MIDIMessage(data, timestamp)`?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77533</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Wilson">cwilso</who>
    <bug_when>2012-10-31 18:19:41 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; I&apos;m not sure what you mean by a type that can be explicitly typecast, could
&gt; you clarify? Do you mean using a constructed type instead, like `new
&gt; MIDIMessage(data, timestamp)`?

In essence, except the other way around.  A Dictionary type just means an Object with those members; unfortunately, they can be organized in any way, and the members need to be &quot;searched&quot; for; these types cannot be optimized down to essentially a struct behind the scenes.  I received feedback that it is best to avoid Dictionary types for basic structures unless absolutely necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77644</commentid>
    <comment_count>3</comment_count>
    <who name="Jussi Kalliokoski">jussi.kalliokoski</who>
    <bug_when>2012-11-01 09:37:41 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; (In reply to comment #1)
&gt; &gt; I&apos;m not sure what you mean by a type that can be explicitly typecast, could
&gt; &gt; you clarify? Do you mean using a constructed type instead, like `new
&gt; &gt; MIDIMessage(data, timestamp)`?
&gt; 
&gt; In essence, except the other way around.  A Dictionary type just means an
&gt; Object with those members; unfortunately, they can be organized in any way,
&gt; and the members need to be &quot;searched&quot; for; these types cannot be optimized
&gt; down to essentially a struct behind the scenes.  I received feedback that it
&gt; is best to avoid Dictionary types for basic structures unless absolutely
&gt; necessary.

True. Since we&apos;ve already simplified the MIDIMessage interface to just contain the data and the timestamp, we might take it a step further, i.e. change the `send(MIDIMessage)` signature to be `send(Uint8Array data, DOMHighResTimeStamp? timestamp)`, and change the MIDIMessage from a dictionary to an interface (since dictionary makes no sense if it&apos;s not ever created by the user).

Thoughts?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77674</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Wilson">cwilso</who>
    <bug_when>2012-11-01 15:32:34 +0000</bug_when>
    <thetext>That&apos;s pretty much the conclusion I&apos;d reached as the solution for https://www.w3.org/Bugs/Public/show_bug.cgi?id=18764 - i.e. as the consolidation of send() and sendMIDIMessage().

I&apos;ll edit it later today.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77728</commentid>
    <comment_count>5</comment_count>
    <who name="Chris Wilson">cwilso</who>
    <bug_when>2012-11-01 23:58:10 +0000</bug_when>
    <thetext>Moved to interface (although the difference is irrelevant, now, since MIDIMessage objects are only created inside the implementation, not by developers.

https://dvcs.w3.org/hg/audio/rev/f939eca58e74</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78472</commentid>
    <comment_count>6</comment_count>
    <who name="Olivier Thereaux">olivier.thereaux</who>
    <bug_when>2012-11-19 16:03:28 +0000</bug_when>
    <thetext>No objection in 2 weeks since resolution. Closing.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>