This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let boolToUInt32 (b:bool) = (# "conv.u4" (# "cgt.un" b 0 : int32 #) : uint32 #) | |
module internal Filter = | |
[<Struct; NoComparison; NoEquality>] | |
type MaskStruct = | |
val mutable _0x00 : bool | |
val mutable _0x01 : bool | |
val mutable _0x02 : bool | |
val mutable _0x03 : bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BitCountingAlgorithms = | |
let inline fastGetBitsCount (i:uint32) = | |
let mutable i = i - ((i >>> 1) &&& 0x55555555u) | |
i <- (i &&& 0x33333333u) + ((i >>> 2) &&& 0x33333333u) | |
(((i + (i >>> 4)) &&& 0x0F0F0F0Fu) * 0x01010101u) >>> 24 | |
let safeGetBits (i:uint32) = | |
let mutable count = 0u | |
let mutable n = i | |
while n <> 0u do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cli = new System.Net.WebClient () | |
let data = | |
cli.DownloadString "https://raw.githubusercontent.com/dwyl/english-words/master/words.txt" | |
|> fun s -> s.Split ([|"\n"; "\r"; System.Environment.NewLine|], System.StringSplitOptions.None) | |
printfn "found %d words - shuffling" data.Length | |
let r = System.Random () | |
for i = 0 to data.Length-1 do | |
let j = r.Next (i, data.Length-1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -65,7 +65,8 @@ type UnionReprDecisions<'Union,'Alt,'Type> | |
isStruct:'Union->bool, | |
nameOfAlt : 'Alt -> string, | |
makeRootType: 'Union -> 'Type, | |
makeNestedType: 'Union * string -> 'Type) = | |
makeNestedType: 'Union * string -> 'Type, | |
hasHelpers: 'Union->IlxUnionHasHelpers) = | |
static let TaggingThresholdFixedConstant = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.Collections.Generic | |
let validate = false | |
#if FROM_MAX | |
let lowerBound = System.Int32.MaxValue - 100000000 | |
let upperBound = System.Int32.MaxValue | |
#else | |
#if FROM_MIN | |
let lowerBound = System.Int32.MinValue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.IO | |
open System.Runtime.Serialization.Formatters.Binary | |
let filename = @"E:\binary"; | |
let data = [ | |
"This", 1 | |
"is", 2 | |
"just", 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open BenchmarkDotNet.Running | |
open BenchmarkDotNet.Attributes | |
open BenchmarkDotNet.Configs | |
open BenchmarkDotNet.Diagnostics.Windows | |
open BenchmarkDotNet.Jobs | |
open System.Collections.Generic | |
open System.Collections | |
open System |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.Diagnostics | |
open Nessos.Streams | |
[<Struct; NoComparison; NoEquality>] | |
type Chunk<'T> = | |
[<DefaultValue false>] val mutable _toProcess : int | |
[<DefaultValue false>] val mutable _1 : 'T | |
[<DefaultValue false>] val mutable _2 : 'T | |
[<DefaultValue false>] val mutable _3 : 'T | |
[<DefaultValue false>] val mutable _4 : 'T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.Diagnostics | |
let createSources size f = [ | |
"array", (lazy (Array.init size f :> seq<_>)) | |
"list", (lazy (List.init size f :> seq<_>)) | |
"computation expression", (lazy (seq { | |
let mutable x = 0 | |
while x < size do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | |
namespace Microsoft.FSharp.Collections | |
#nowarn "52" // The value has been copied to ensure the original is not mutated by this operation | |
open System | |
open System.Diagnostics | |
open System.Collections | |
open System.Collections.Generic | |
open Microsoft.FSharp.Core |