Skip to content

Instantly share code, notes, and snippets.

Shared Function TypeofIntoNullableT(of T As Structure, U As Structure)(input As T?, ByRef output As U?) As Boolean
  output = If(input.HasValue, Microsoft.VisualBasic.CompilerServices.Conversions.ToGenericParameter(Of U?)(input.Value)), NOthing)
  Return output.HasValue
End Function
Dim input As Integer? = 123
Dim output As Double? = 0
@AdamSpeight2008
AdamSpeight2008 / NestedEnumerableOfT.vb
Created January 13, 2016 20:42
NestedEnumerable(Of T)
Public Class RootEnumerator(Of T)
Implements IEnumerator(Of T)
Dim stk As New Stack(Of NestedEnumerator(Of T))
Public Sub New(e As NestedEnumerator(Of T))
stk.Push(e)
End Sub
Public ReadOnly Property Current As T Implements IEnumerator(Of T).Current
Get
If ((stk.Count = 0) OrElse (stk.Peek.pc = 0)) Then Throw New InvalidOperationException()
<?xml version="1.0" encoding="utf-8"?>
<results total0="00:00:03.9249847" total1="00:02:21.7224061">
<Project name="BasicCodeAnalysis" path="C:\Users\Adam\Downloads\roslyn-master\Binaries\Debug\Microsoft.CodeAnalysis.VisualBasic.dll">
<doc timing="00:00:00.0000289" postGC="00:00:00.0438092" name="BoundNodes.xml.Generated.vb" />
<doc timing="00:00:00.0002168" postGC="00:00:00.0439427" name="Analyzer.vb" />
<doc timing="00:00:00.0001905" postGC="00:00:00.0439173" name="AbstractFlowPass.AbstractLocalState.vb" />
<doc timing="00:00:00.0004341" postGC="00:00:00.0441583" name="AbstractFlowPass.NestedTypes.vb" />
<doc timing="00:00:00.0004336" postGC="00:00:00.0441542" name="AbstractFlowPass.Regions.vb" />
<doc timing="00:00:00.0078362" postGC="00:00:00.0522864" name="AbstractFlowPass.vb" />
<doc timing="00:00:00.0003405" postGC="00:00:00.0446755" name="AbstractRegionControlFlowPass.vb" />
@AdamSpeight2008
AdamSpeight2008 / Original.xml
Created December 5, 2015 22:29
Results for Peep timings.
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="utf-8"?>
<results total0="00:00:13.6844994" total1="00:08:21.7542971">
<Project name="Microsoft.DiaSymReader.PortablePdb" path="C:\Users\Adam\Downloads\roslyn-master\Binaries\Debug\Microsoft.DiaSymReader.PortablePdb.dll">
<doc timing="00:00:00.0840846" postGC="00:00:00.1390587" name="ImmutableArrayExtensions.cs" />
<doc timing="00:00:00.0551817" postGC="00:00:00.0738233" name="ReflectionUtilities.cs" />
<doc timing="00:00:00.0055908" postGC="00:00:00.0235188" name="PortableShim.cs" />
<doc timing="00:00:00.0103274" postGC="00:00:00.0283736" name="ArrayShape.cs" />
<doc timing="00:00:00.0004164" postGC="00:00:00.0178181" name="CustomModifier.cs" />
<doc timing="00:00:00.0038587" postGC="00:00:00.0216730" name="ISignatureTypeProvider.cs" />
@AdamSpeight2008
AdamSpeight2008 / Deltas.txt
Last active December 4, 2015 19:24
Scanner Perf
-00:00:00.0000002 C:\Users\Adam\Downloads\roslyn-master\src\Compilers\VisualBasic\Portable\Parser\ISyntaxFactoryContext.vb
-00:00:00.0000002 C:\Users\Adam\Downloads\roslyn-master\src\Compilers\VisualBasic\Test\Emit\Attributes\AssemblyAttributes.vb
-00:00:00.0000003 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCompilerSyntaxTest\Debug\GeneratedAssemblyInfo_42.42.42.42.vb
-00:00:00.0000003 C:\Users\Adam\Downloads\roslyn-master\src\Compilers\Test\Resources\Core\MetadataTests\InterfaceAndClass\VBInterfaces01.vb
-00:00:00.0000003 C:\Users\Adam\Downloads\roslyn-master\src\Compilers\Test\Resources\Core\MetadataTests\Invalid\ManyMethodSpecs.vb
-00:00:00.0000003 C:\Users\Adam\Downloads\roslyn-master\src\Compilers\Test\Resources\Core\PerfTests\VBPerfTest.vb
-00:00:00.0000003 C:\Users\Adam\Downloads\roslyn-master\src\Compilers\Test\Resources\Core\SymbolsTests\MDTestLib1.vb
-00:00:00.0000003 C:\Users\Adam\Downloads\roslyn-master\src\Compilers\Test\Resources\Core\SymbolsTests\CyclicInheritance\Class2.vb
@AdamSpeight2008
AdamSpeight2008 / Deltas.txt
Last active December 3, 2015 20:12
Parse Timings (Base vs Peep)
00:00:00.0065987 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCodeAnalysis\Debug\GeneratedAssemblyInfo_42.42.42.42.vb
00:00:00.0000065 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCodeAnalysis\Debug\GeneratedInternalsVisibleTo.vb
-00:00:00.0000006 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCommandLineTest\Debug\GeneratedAssemblyInfo_42.42.42.42.vb
-00:00:00.0000077 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCompilerEmitTest\Debug\GeneratedAssemblyInfo_42.42.42.42.vb
-00:00:00.0000003 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCompilerPerformanceTest\Debug\GeneratedAssemblyInfo_42.42.42.42.vb
-00:00:00.0000006 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCompilerSemanticTest\Debug\GeneratedAssemblyInfo_42.42.42.42.vb
-00:00:00.0000068 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCompilerSymbolTest\Debug\GeneratedAssemblyInfo_42.42.42.42.vb
-00:00:00.0000009 C:\Users\Adam\Downloads\roslyn-master\Binaries\Obj\BasicCompiler
@AdamSpeight2008
AdamSpeight2008 / gist:eab776f68509d858c374
Created November 23, 2015 07:19
Digit Character Value (Test Results)
Method_1(0) : 0 307
Method_1(1) : 10000000 306
Method_1(2) : 20000000 381
Method_1(3) : 30000000 425
Method_1(4) : 40000000 405
Method_1(5) : 50000000 408
Method_1(6) : 60000000 401
Method_1(7) : 70000000 403
Method_1(8) : 80000000 340
Method_1(9) : 90000000 282
@AdamSpeight2008
AdamSpeight2008 / gist:c42b222dbc3ccac1177e
Created November 23, 2015 06:58
Digit Character Value (Test Results)
Method_1(0) : 0 510
Method_1(1) : 10000000 525
Method_1(2) : 20000000 551
Method_1(3) : 30000000 579
Method_1(4) : 40000000 576
Method_1(5) : 50000000 573
Method_1(6) : 60000000 578
Method_1(7) : 70000000 576
Method_1(8) : 80000000 526
Method_1(9) : 90000000 478
@AdamSpeight2008
AdamSpeight2008 / gist:c7d4469a45542a6e5414
Created November 23, 2015 06:57
Digit Character Value (Test Code)
Imports System.Runtime.CompilerServices
Module Module1
Dim sw As New Stopwatch
Dim taken As Long = 0
Sub Main()
Dim methods() As Func(Of Char, Byte) = {AddressOf XX.Method1,
AddressOf XX.Method2,
AddressOf XX.IntegralLiteralCharacterValue,
AddressOf XX.Method3,
<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl" href="ActivityLog.xsl"?>
<activity>
<entry>
<record>1</record>
<time>2015/11/14 18:23:08.764</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Microsoft Visual Studio 2015 RC version: 14.0.24627.0</description>
</entry>