Selaa lähdekoodia

feat(JitsiParticipant) use a Map for properties, rather than an object

See https://www.zhenghao.io/posts/object-vs-map

Since these objects will change with reasonable requency, we'll create
many shapes and consume more memory than a Map.
release-8443
Saúl Ibarra Corretgé 11 kuukautta sitten
vanhempi
commit
a72936d864
1 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. 4
    4
      JitsiParticipant.js

+ 4
- 4
JitsiParticipant.js Näytä tiedosto

@@ -39,7 +39,7 @@ export default class JitsiParticipant {
39 39
         this._status = status;
40 40
         this._hidden = hidden;
41 41
         this._statsID = statsID;
42
-        this._properties = {};
42
+        this._properties = new Map();
43 43
         this._identity = identity;
44 44
         this._isReplacing = isReplacing;
45 45
         this._isReplaced = isReplaced;
@@ -171,7 +171,7 @@ export default class JitsiParticipant {
171 171
      * Gets the value of a property of this participant.
172 172
      */
173 173
     getProperty(name) {
174
-        return this._properties[name];
174
+        return this._properties.get(name);
175 175
     }
176 176
 
177 177
     /**
@@ -347,10 +347,10 @@ export default class JitsiParticipant {
347 347
      * @value the value to set.
348 348
      */
349 349
     setProperty(name, value) {
350
-        const oldValue = this._properties[name];
350
+        const oldValue = this._properties.get(name);
351 351
 
352 352
         if (value !== oldValue) {
353
-            this._properties[name] = value;
353
+            this._properties.set(name, value);
354 354
             this._conference.eventEmitter.emit(
355 355
                 JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
356 356
                 this,

Loading…
Peruuta
Tallenna