浏览代码

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 个月前
父节点
当前提交
a72936d864
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4
    4
      JitsiParticipant.js

+ 4
- 4
JitsiParticipant.js 查看文件

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

正在加载...
取消
保存