Skip to content

Instantly share code, notes, and snippets.

08-Feb-17 21:26:48 TypeCheckOneFile (E:\github\visualfsharp\src\fsharp\vs\service.fs)
08-Feb-17 21:26:49 <-- TypeCheckOneFile (E:\github\visualfsharp\src\fsharp\vs\service.fs), 00:00:01.2319412 elapsed
08-Feb-17 21:27:02 TypeCheckOneFile (E:\github\visualfsharp\src\fsharp\FSharp.LanguageService.Compiler\obj\Debug\net40\FSComp.fs)
08-Feb-17 21:27:13 <-- TypeCheckOneFile (E:\github\visualfsharp\src\fsharp\FSharp.LanguageService.Compiler\obj\Debug\net40\FSComp.fs), 00:00:10.4436347 elapsed
08-Feb-17 21:27:13 TypeCheckOneFile (C:\Users\vaski\AppData\Local\Temp\.NETFramework,Version=v4.6.AssemblyAttributes.fs)
08-Feb-17 21:27:13 <-- TypeCheckOneFile (C:\Users\vaski\AppData\Local\Temp\.NETFramework,Version=v4.6.AssemblyAttributes.fs), 00:00:00.0012807 elapsed
08-Feb-17 21:27:13 TypeCheckOneFile (C:\Users\vaski\AppData\Local\Temp\FSharp.LanguageService.Compiler.15.4.1.0.AssemblyFileVersion.fs)
08-Feb-17 21:27:13 <-- TypeCheckOneFile (C:\Users\vaski\AppData\Local\Temp\FSharp.LanguageService.Compiler.15.4.1.0.Assembly
> FSharp.Editor.dll!<StartupCode$FSharp-Editor>.$LanguageService.runningDocumentTableEvents@92.Microsoft.VisualStudio.Shell.Interop.IVsRunningDocTableEvents.Microsoft-VisualStudio-Shell-Interop-IVsRunningDocTableEvents-OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame pFrame) Line 98 F#
[Native to Managed Transition]
[Managed to Native Transition]
Microsoft.VisualStudio.Platform.WindowManagement.dll!Microsoft.VisualStudio.Platform.WindowManagement.Rdt.NotifyOnBeforeShow(uint cookie, bool firstShow, Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame frame) Unknown
Microsoft.VisualStudio.Platform.WindowManagement.dll!Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.NotifyFrameShowing(uint cookie, bool firstShow) Unknown
Microsoft.VisualStudio.Platform.WindowManagement.dll!Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ShowInternal(Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ShowFlags showFlags) U
type ChoiceBuilder with
member __.Bind (m: unit -> 'a, binder: 'a -> Choice<'b, exn>) : Choice<'b, exn> =
Choice.attempt m |> Choice.bind binder
member __.ReturnFrom (m: unit -> 'a) : Choice<'a, exn> = Choice.attempt m
let x =
choice {
use! file = fun _ -> new StreamReader (File.OpenRead "foo")
let! line = fun _ -> (file: StreamReader).ReadLine() // without this type annotation it does not compile. Why?

Yesod

https://github.com/vasily-kirichenko/yesod-one

$ wrk -c100 -t10 -d30s --latency http://localhost:3000
Running 30s test @ http://localhost:3000
  10 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    23.16ms   13.36ms  96.95ms   73.41%
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
public static class Program {
public static void Main(args: string[]) {
WebHostBuilder()
.UseUrls("http://localhost:8085")
.UseKestrel()
.Configure(a => a.Run(c => c.Response.WriteAsync("Hello from Plain Kestrel!")))
[<AutoOpen>]
module Utils =
let inline (^) x = (<|) x
let compute() =
let rec fib n = if n < 2 then n else fib (n - 1) + fib (n - 2)
fib 44 |> ignore
let inline print fmt =
kprintf (fun x ->
import scala.collection._
import scala.util.Random
object Utils {
def time[A](name: String) (f: => Unit) = {
val s = System.nanoTime
f
println(s"$name: ${((System.nanoTime - s) / 1e6).toLong} elapsed.")
}
}
[EntryPoint]
public static int main(string[] _arg1)
{
Stopwatch sw = Stopwatch.StartNew();
for (int i = 1; i < 100000001; i++)
{
double a = (double)i / 1000.0;
double num = Math.Sin(a);
}
sw.Stop();
[EntryPoint]
public static int main(string[] _arg1)
{
Stopwatch sw = Stopwatch.StartNew();
for (int i = 1; i < 100000001; i++)
{
double num = (double)i / 1000.0;
StructTuple<double, double> structTuple = new StructTuple<double, double>(num, Math.Sin(num));
}
sw.Stop();
let foo x = struct (x, Math.Sin x)
...
for n in 1..100000000 do
let struct (x, sinx) = foo (float n / 1000.)
...
// Debug
// Run: 00:00:03.5127102
// GC.Collect 2: 00:00:00.0001495
// Release