I've done some forensics. As you type in WhatsApp, there are two files that are repeatedly opened and closed (i.e. they appear and disappear from `lsof` results. Those files are
~/Library/Group Containers/group.net.whatsapp.WhatsApp.shared/Logs/WhatsApp_2/whatsapp-2024-11-25-11-04-18-1351-WhatsApp-1481.log
/private/var/db/eligibilityd/eligibility.plist
(obviously with numbers in the log filename changing occasionally)
In the logfile we see:
11:04:19.644 [ 11513] [main-thread ] [F] LL_A ai/manager/feature/bonsai-entry-point-not-enabled
11:04:19.644 [ 11513] [main-thread ] [F] LL_A ai/manager/composer-new-chat-ai-status/disabled
11:04:19.647 [ 11513] [main-thread ] [F] LL_A ai/manager/feature/bonsai-entry-point-not-enabled
11:04:19.647 [ 11513] [main-thread ] [F] LL_A ai/manager/composer-new-chat-ai-status/disabled
11:04:19.650 [ 11513] [main-thread ] [F] LL_A ai/manager/feature/bonsai-entry-point-not-enabled
11:04:19.650 [ 11513] [main-thread ] [F] LL_A ai/manager/composer-new-chat-ai-status/disabled
11:04:19.652 [ 11513] [main-thread ] [F] LL_A ai/manager/feature/bonsai-entry-point-not-enabled
11:04:19.652 [ 11513] [main-thread ] [F] LL_A ai/manager/composer-new-chat-ai-status/disabled
11:04:19.655 [ 11513] [main-thread ] [F] LL_A ai/manager/feature/bonsai-entry-point-not-enabled
11:04:19.655 [ 11513] [main-thread ] [F] LL_A ai/manager/composer-new-chat-ai-status/disabled
11:04:19.658 [ 11513] [main-thread ] [F] LL_A ai/manager/feature/bonsai-entry-point-not-enabled
11:04:19.658 [ 11513] [main-thread ] [F] LL_A ai/manager/composer-new-chat-ai-status/disabled
11:04:19.686 [ 11513] [main-thread ] [F] LL_A ai/manager/feature/bonsai-entry-point-not-enabled
You can see there's 3ms between these, and there are hundreds of entries per second.
This is consistent with the observation that enabling Apple AI helps - it seems to be in an expensive loop of repeatedly trying to use AI and getting a "no". Getting a "yes" gets it out of that loop.
But I don't know whether it's the trying to use AI that's ultimately causing the slowness, or the logging itself. If it re-opens the logfile every time it writes to it -- which seems to be the case -- AV may well re-scan it anew every time. That's consistent with the observation that disabling ESET's scan-on-open fixes the issue.
... and disabling "Scan on - file open" does fix the issue, but disabling AV globally is not something you should do!
Those experiencing this issue who don't have AV -- maybe they're on slower computers where the file operations are noticeable even without AV -- or maybe their slowness isn't as extreme as AV users are noticing -- or maybe they have some AV they're not aware of.
However, I tried adding `/Users/[username]/Library/Group Containers/group.net.whatsapp.WhatsApp.shared/Logs/*` to ESET's "performance exclusions" list, and this didn't help. I don't know whether that's because this is not the cause, or whether ESET just isn't honouring the exclusion.