Created
July 21, 2018 06:00
-
-
Save manofstick/e97dc9775bf01fd22b2f238cac9f1c27 to your computer and use it in GitHub Desktop.
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.Drawing | |
open System.Diagnostics | |
let colours = [ | |
"Transparent", Color.Transparent | |
"AliceBlue", Color.AliceBlue | |
"AntiqueWhite", Color.AntiqueWhite | |
"Aqua", Color.Aqua | |
"Aquamarine", Color.Aquamarine | |
"Azure", Color.Azure | |
"Beige", Color.Beige | |
"Bisque", Color.Bisque | |
"Black", Color.Black | |
"BlanchedAlmond", Color.BlanchedAlmond | |
"Blue", Color.Blue | |
"BlueViolet", Color.BlueViolet | |
"Brown", Color.Brown | |
"BurlyWood", Color.BurlyWood | |
"CadetBlue", Color.CadetBlue | |
"Chartreuse", Color.Chartreuse | |
"Chocolate", Color.Chocolate | |
"Coral", Color.Coral | |
"CornflowerBlue", Color.CornflowerBlue | |
"Cornsilk", Color.Cornsilk | |
"Crimson", Color.Crimson | |
"Cyan", Color.Cyan | |
"DarkBlue", Color.DarkBlue | |
"DarkCyan", Color.DarkCyan | |
"DarkGoldenrod", Color.DarkGoldenrod | |
"DarkGray", Color.DarkGray | |
"DarkGreen", Color.DarkGreen | |
"DarkKhaki", Color.DarkKhaki | |
"DarkMagenta", Color.DarkMagenta | |
"DarkOliveGreen", Color.DarkOliveGreen | |
"DarkOrange", Color.DarkOrange | |
"DarkOrchid", Color.DarkOrchid | |
"DarkRed", Color.DarkRed | |
"DarkSalmon", Color.DarkSalmon | |
"DarkSeaGreen", Color.DarkSeaGreen | |
"DarkSlateBlue", Color.DarkSlateBlue | |
"DarkSlateGray", Color.DarkSlateGray | |
"DarkTurquoise", Color.DarkTurquoise | |
"DarkViolet", Color.DarkViolet | |
"DeepPink", Color.DeepPink | |
"DeepSkyBlue", Color.DeepSkyBlue | |
"DimGray", Color.DimGray | |
"DodgerBlue", Color.DodgerBlue | |
"Firebrick", Color.Firebrick | |
"FloralWhite", Color.FloralWhite | |
"ForestGreen", Color.ForestGreen | |
"Fuchsia", Color.Fuchsia | |
"Gainsboro", Color.Gainsboro | |
"GhostWhite", Color.GhostWhite | |
"Gold", Color.Gold | |
"Goldenrod", Color.Goldenrod | |
"Gray", Color.Gray | |
"Green", Color.Green | |
"GreenYellow", Color.GreenYellow | |
"Honeydew", Color.Honeydew | |
"HotPink", Color.HotPink | |
"IndianRed", Color.IndianRed | |
"Indigo", Color.Indigo | |
"Ivory", Color.Ivory | |
"Khaki", Color.Khaki | |
"Lavender", Color.Lavender | |
"LavenderBlush", Color.LavenderBlush | |
"LawnGreen", Color.LawnGreen | |
"LemonChiffon", Color.LemonChiffon | |
"LightBlue", Color.LightBlue | |
"LightCoral", Color.LightCoral | |
"LightCyan", Color.LightCyan | |
"LightGoldenrodYellow", Color.LightGoldenrodYellow | |
"LightGray", Color.LightGray | |
"LightGreen", Color.LightGreen | |
"LightPink", Color.LightPink | |
"LightSalmon", Color.LightSalmon | |
"LightSeaGreen", Color.LightSeaGreen | |
"LightSkyBlue", Color.LightSkyBlue | |
"LightSlateGray", Color.LightSlateGray | |
"LightSteelBlue", Color.LightSteelBlue | |
"LightYellow", Color.LightYellow | |
"Lime", Color.Lime | |
"LimeGreen", Color.LimeGreen | |
"Linen", Color.Linen | |
"Magenta", Color.Magenta | |
"Maroon", Color.Maroon | |
"MediumAquamarine", Color.MediumAquamarine | |
"MediumBlue", Color.MediumBlue | |
"MediumOrchid", Color.MediumOrchid | |
"MediumPurple", Color.MediumPurple | |
"MediumSeaGreen", Color.MediumSeaGreen | |
"MediumSlateBlue", Color.MediumSlateBlue | |
"MediumSpringGreen", Color.MediumSpringGreen | |
"MediumTurquoise", Color.MediumTurquoise | |
"MediumVioletRed", Color.MediumVioletRed | |
"MidnightBlue", Color.MidnightBlue | |
"MintCream", Color.MintCream | |
"MistyRose", Color.MistyRose | |
"Moccasin", Color.Moccasin | |
"NavajoWhite", Color.NavajoWhite | |
"Navy", Color.Navy | |
"OldLace", Color.OldLace | |
"Olive", Color.Olive | |
"OliveDrab", Color.OliveDrab | |
"Orange", Color.Orange | |
"OrangeRed", Color.OrangeRed | |
"Orchid", Color.Orchid | |
"PaleGoldenrod", Color.PaleGoldenrod | |
"PaleGreen", Color.PaleGreen | |
"PaleTurquoise", Color.PaleTurquoise | |
"PaleVioletRed", Color.PaleVioletRed | |
"PapayaWhip", Color.PapayaWhip | |
"PeachPuff", Color.PeachPuff | |
"Peru", Color.Peru | |
"Pink", Color.Pink | |
"Plum", Color.Plum | |
"PowderBlue", Color.PowderBlue | |
"Purple", Color.Purple | |
"Red", Color.Red | |
"RosyBrown", Color.RosyBrown | |
"RoyalBlue", Color.RoyalBlue | |
"SaddleBrown", Color.SaddleBrown | |
"Salmon", Color.Salmon | |
"SandyBrown", Color.SandyBrown | |
"SeaGreen", Color.SeaGreen | |
"SeaShell", Color.SeaShell | |
"Sienna", Color.Sienna | |
"Silver", Color.Silver | |
"SkyBlue", Color.SkyBlue | |
"SlateBlue", Color.SlateBlue | |
"SlateGray", Color.SlateGray | |
"Snow", Color.Snow | |
"SpringGreen", Color.SpringGreen | |
"SteelBlue", Color.SteelBlue | |
"Tan", Color.Tan | |
"Teal", Color.Teal | |
"Thistle", Color.Thistle | |
"Tomato", Color.Tomato | |
"Turquoise", Color.Turquoise | |
"Violet", Color.Violet | |
"Wheat", Color.Wheat | |
"White", Color.White | |
"WhiteSmoke", Color.WhiteSmoke | |
"Yellow", Color.Yellow | |
"YellowGreen", Color.YellowGreen | |
] | |
[<EntryPoint>] | |
let main argv = | |
let sw = Stopwatch.StartNew () | |
for __ = 1 to 10000 do | |
let map = colours |> Map.ofList | |
if map |> Map.isEmpty then failwith "huh?" | |
let creation = sw.ElapsedMilliseconds | |
let colourMap = colours |> Map.ofList | |
for __ = 1 to 10000 do | |
for key,_ in colours do | |
let c = colourMap.[key] | |
if not c.IsKnownColor then failwith "huh?" | |
let access = sw.ElapsedMilliseconds | |
printfn "colours,%s,%d,%d" (if Environment.Is64BitProcess then "64-bit" else "32-bit") creation access | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment