Open Bug 1816251 Opened 2 years ago Updated 2 years ago

[web.whatsapp.com] - Clicking on "Files, links and documents" degrades performance

Categories

(Core :: JavaScript Engine: JIT, defect, P3)

Firefox 112
x86_64
Windows 10
defect

Tracking

()

Tracking Status
firefox112 --- affected

People

(Reporter: alex_mayorga, Unassigned)

References

(Blocks 2 open bugs, )

Details

(Keywords: nightly-community, perf:resource-use, perf:responsiveness)

Attachments

(2 files)

​​### Basic information

Steps to Reproduce:

  • Load https://web.whatsapp.com/
  • Login
  • Click a conversation
  • Click the icon or conversation name
  • Click on "Files, links and documents"

Expected Results:
No performance degradation

Actual Results:
Laptop fan goes crazy
https://share.firefox.dev/3xgY6Bc


Performance recording (profile)

Profile URL:
(If this report is about slow performance or high CPU usage, please capture a performance profile by following the instructions at https://profiler.firefox.com/. Then upload the profile and insert the link here.)

System configuration:

OS version:
GPU model:
Number of cores:
Amount of memory (RAM):

More information

Please consider attaching the following information after filing this bug, if relevant:

  • Screenshot / screen recording
  • Anonymized about:memory dump, for issues with memory usage
  • Troubleshooting information: Go to about:support, click "Copy text to clipboard", paste it to a file, save it, and attach the file here.

Thanks so much for your help.

Attached file memory-report.json.gz (deleted) —
Attached file about:support (deleted) —
Component: Performance → JavaScript: GC

Folding everything under replace_moz_arena_malloc within the profile from comment 0 highlight that 99% of the time is spent within replace_moz_arena_malloc.

Component: JavaScript: GC → Memory Allocator

The severity field is not set for this bug.
:glandium, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(mh+mozilla)

(In reply to Nicolas B. Pierron [:nbp] from comment #3)

Folding everything under replace_moz_arena_malloc within the profile from comment 0 highlight that 99% of the time is spent within replace_moz_arena_malloc.

I don't see anything like that in https://share.firefox.dev/3xgY6Bc, in none of the Parent process, web extensions process, GPU process or whatsapp process. Where do you see that?

Flags: needinfo?(mh+mozilla) → needinfo?(nicolas.b.pierron)

(In reply to Mike Hommey [:glandium] from comment #5)

(In reply to Nicolas B. Pierron [:nbp] from comment #3)

Folding everything under replace_moz_arena_malloc within the profile from comment 0 highlight that 99% of the time is spent within replace_moz_arena_malloc.

I don't see anything like that in https://share.firefox.dev/3xgY6Bc, in none of the Parent process, web extensions process, GPU process or whatsapp process. Where do you see that?

I cannot find it anymore :/
I most likely kept the filter on while reporting this, otherwise I do not see any other explanations …

I will move it back to the JS component and re-triage it next week.

Component: Memory Allocator → JavaScript: GC
Flags: needinfo?(nicolas.b.pierron)

I did some profiling on my own, while I was not able to reproduce the ~600ms hangs as reported, I only saw 60ms hangs.
However, the Mutation Observer callbacks are still high in the captured profile.

Once focused on the highest function on the mutation observer callback, the most time consuming function is t.default inner function with ~7% of the mutation callback handler:

Code from https://web.whatsapp.com/app.fb6a489ddae1e000677a.js:68:56798 :

  933173: (e,t,r)=>{
    "use strict";
    var n = r(595318);
    Object.defineProperty(t, "__esModule" , { value: !0 }),
    t.default = function(e, t) {
      let r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : i.default.isWid ,
           n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : a.createWid,
           o = t;
      switch(e) {
        case "author":
        case "broadcast":
        case "chat":
        case "descOwner":
        case "from":
        case "gid":
        case "id":
        case "jid":
        case "owner":
        case "participant":
        case "quotedRemoteJid":
        case "quotedParticipant":
        case "remote":
        case "subjectOwner":
        case "s_o":
        case "to":
        case "wid":
        case "changeNumberNewJid":
        case "changeNumberOldJid":
        case "recipient":
        case "paymentMessageReceiverJid":
        case "parentGroup":
        case "phoneNumber":
        case "revokeSender":
        case "ephemeralSettingUser":
          r(t) && (o = n(t));
          break;
        default:
          const i = parseInt(e,10);
          !isNaN(i) && r(t) && (o = n(t))
      }
     return o
    };
    var i = n(r(124928)), a = r(669050)
  }

I suspect the cost of this function comes from the chain of string comparisons which can probably be optimized in Ion, either by folding the multiple string comparisons as a character search in a tree, or by doing a tree-search of the atomized pointer.

Blocks: sm-opt-jits
Severity: -- → S4
Component: JavaScript: GC → JavaScript Engine: JIT
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: