-
Notifications
You must be signed in to change notification settings - Fork 843
Open
Labels
Milestone
Description
When I open my project and afk, CPU usage is near 0%.
Sometimes when I work for a while, and then afk, CPU usage doesn't decrease to 0%, still remains at 5%.
Although it's low, my fan don't think so.
Repro steps
I don't know?
Open a project, randomly delete something and undo?
Or open a HUGE project, and open as many tabs as you can?
Related information
Actually I captured a flame graph. It says
fsharp/src/Compiler/Utilities/Caches.fs
Lines 273 to 305 in cd4fdf2
| let rebuildStore () = | |
| let newStore = | |
| ConcurrentDictionary<'Key, CachedEntity<'Key, 'Value>>(Environment.ProcessorCount, capacity, options.Comparer) | |
| for entity in evictionQueue do | |
| newStore.TryAdd(entity.Key, entity) |> ignore | |
| Interlocked.Exchange(&store, newStore) |> ignore | |
| let processEvictionMessage msg = | |
| match msg with | |
| | EvictionQueueMessage.Add(entity: CachedEntity<_, _>, target) when isNull entity.Node.List -> | |
| evictionQueue.AddLast(entity.Node) | |
| // store has been rebuilt while this message was in the queue. | |
| if store <> target then | |
| store.TryAdd(entity.Key, entity) |> ignore | |
| // Evict one immediately if necessary. | |
| if evictionQueue.Count > capacity then | |
| let first = nonNull evictionQueue.First | |
| evictionQueue.Remove(first) | |
| match store.TryRemove(first.Value.Key) with | |
| | true, _ -> | |
| CacheMetrics.Eviction &tags | |
| evicted.Trigger() | |
| | _ -> | |
| CacheMetrics.EvictionFail &tags | |
| evictionFailed.Trigger() | |
| deadKeysCount <- deadKeysCount + 1 | |
| if deadKeysCount > headroom / 2 then | |
| rebuildStore () |
these two functions consumes 80% of the 5% CPU usage.
I can't investigate further, sorry.
majocha
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
New