Skip to content

F# Intellisense eats my CPU #19212

@wuke32767

Description

@wuke32767

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

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions