Skip to content
Closed
Changes from 3 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
11aead0
starting point for testing AsyncLocal impact
majocha Feb 13, 2024
34d9816
Merge branch 'main' into asynclocal-compare
majocha Feb 13, 2024
35f9a9b
fix Release mode
majocha Feb 13, 2024
2d637fb
Merge branch 'asynclocal-compare' of https://github.com/majocha/fshar…
majocha Feb 13, 2024
799ad0d
Merge branch 'main' into asynclocal-compare
majocha Feb 13, 2024
2a1cb73
log thread id
majocha Feb 13, 2024
0638056
noop NodeCode to see what breaks
majocha Feb 13, 2024
0a72208
more useful log
majocha Feb 13, 2024
7b34814
some attempts
majocha Feb 14, 2024
c817d61
zero thread statics in service entry pointsome attempts
majocha Feb 14, 2024
7fbbb3e
wip
majocha Feb 14, 2024
aa46ad3
Merge branch 'main' into asynclocal-compare
majocha Feb 14, 2024
98f5ff3
merge
majocha Feb 14, 2024
3e129fe
wip
majocha Feb 14, 2024
d8fb4a7
do not initialize in getters
majocha Feb 14, 2024
0cbbd65
test showing a problem with NodeCode
majocha Feb 14, 2024
64233fb
Merge branch 'main' into nodecode-awaitasync
majocha Feb 14, 2024
64c6f6c
merge
majocha Feb 14, 2024
73faf7e
fix test
majocha Feb 15, 2024
32454c5
more logging
majocha Feb 15, 2024
d405abd
fix some tests
majocha Feb 15, 2024
36b89ec
deparallelize a bit for now
majocha Feb 15, 2024
fbdbc9c
a lot of nulls in AsyncMemoize.Get, unfortunately
majocha Feb 15, 2024
eabf7e7
Merge branch 'main' into asynclocal-compare
majocha Feb 15, 2024
f0e59ed
don't pass non-threadsafe logger to parallel computations
majocha Feb 15, 2024
7c023a7
merge nodecode-parallel
majocha Feb 15, 2024
61d42f9
warn on AwaitAsync
majocha Feb 15, 2024
729fa6a
fix using
majocha Feb 15, 2024
3276021
just trace, callstack is useless
majocha Feb 15, 2024
73aea2b
revert
majocha Feb 15, 2024
425a180
duplicated
majocha Feb 16, 2024
3b75c59
restore
majocha Feb 16, 2024
2f78f41
fix some tests hopefuly
majocha Feb 16, 2024
4e60228
noop for now
majocha Feb 16, 2024
f8a1d34
remove
majocha Feb 16, 2024
3efb96e
fix
majocha Feb 16, 2024
9ec30c3
better Parallel
majocha Feb 16, 2024
6848559
wip
majocha Feb 16, 2024
0697453
wip
majocha Feb 16, 2024
1f8d8aa
Merge branch 'main' into asynclocal-compare
majocha Feb 16, 2024
3ea3006
wip
majocha Feb 16, 2024
12ba20e
merge main
majocha Feb 17, 2024
b8a41ca
Merge branch 'main' into asynclocal-compare
majocha Feb 17, 2024
2931c57
check only in getter
majocha Feb 17, 2024
2524df6
init logger for parse
majocha Feb 17, 2024
3802de6
wip
majocha Feb 17, 2024
a3de922
Merge branch 'asynclocal-compare' of https://github.com/majocha/fshar…
majocha Feb 17, 2024
9ad9689
wip
majocha Feb 17, 2024
aa2cc25
Merge branch 'main' into asynclocal-compare
majocha Feb 18, 2024
a8a62bf
f
majocha Feb 18, 2024
90aa5b4
check
majocha Feb 18, 2024
114f682
restore assertfalse
majocha Feb 18, 2024
01af47d
Merge branch 'asynclocal-compare' of https://github.com/majocha/fshar…
majocha Feb 19, 2024
a9359f0
trace UseDiagnosticsLogger
majocha Feb 19, 2024
f137d4d
Merge branch 'main' into asynclocal-compare
majocha Feb 19, 2024
65351d9
Merge branch 'asynclocal-compare' of https://github.com/majocha/fshar…
majocha Feb 19, 2024
efa7207
wip
majocha Feb 19, 2024
785bf2d
fix CompilerImports behavor
majocha Feb 19, 2024
8ee075f
min diff
majocha Feb 20, 2024
7336e46
wrapThreadStaticInfo
majocha Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions tests/FSharp.Compiler.UnitTests/BuildGraphTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -237,23 +237,29 @@ module BuildGraphTests =


[<Fact>]
let internal ``NodeCode preserves DiagnosticsThreadStatics`` () =
let ``NodeCode preserves DiagnosticsThreadStatics`` () =
let random =
let rng = Random()
fun n -> rng.Next n

let job phase _ = node {
do! random 10 |> Async.Sleep |> NodeCode.AwaitAsync
Assert.Equal(phase, DiagnosticsThreadStatics.BuildPhase)
let asyncTask expectedPhase = async {
do! Async.Sleep 10
Assert.Equal(expectedPhase, DiagnosticsThreadStatics.BuildPhase)
}


let rec job phase i = node {
for i in 1 .. 10 do
Assert.Equal(phase, DiagnosticsThreadStatics.BuildPhase)
do! asyncTask phase |> NodeCode.AwaitAsync
}

let work (phase: BuildPhase) =
node {
use _ = new CompilationGlobalsScope(DiscardErrorsLogger, phase)
DiagnosticsThreadStatics.BuildPhase <- phase
let! _ = Seq.init 8 (job phase) |> NodeCode.Parallel
Assert.Equal(phase, DiagnosticsThreadStatics.BuildPhase)
}

let phases = [|
BuildPhase.DefaultPhase
BuildPhase.Compile
Expand All @@ -267,10 +273,10 @@ module BuildGraphTests =
BuildPhase.Output
BuildPhase.Interactive
|]

// start a bunch of computations in parallel, simulating a typical IDE scenario.

let pickRandomPhase _ = phases[random phases.Length]
Seq.init 100 pickRandomPhase

Seq.init 10 pickRandomPhase
|> Seq.map (work >> Async.AwaitNodeCode)
|> Async.Parallel
|> Async.RunSynchronously