##// END OF EJS Templates
sync
cin -
r103:b3f5bc613905 v2
parent child
Show More
@@ -1,46 +1,46
1 <?xml version="1.0" encoding="utf-8"?>
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProductVersion>8.0.30703</ProductVersion>
6 <ProductVersion>8.0.30703</ProductVersion>
7 <SchemaVersion>2.0</SchemaVersion>
7 <SchemaVersion>2.0</SchemaVersion>
8 <ProjectGuid>{15DD7123-D504-4627-8B4F-D00C7F04D033}</ProjectGuid>
8 <ProjectGuid>{15DD7123-D504-4627-8B4F-D00C7F04D033}</ProjectGuid>
9 <OutputType>Exe</OutputType>
9 <OutputType>Exe</OutputType>
10 <RootNamespace>MonoPlay</RootNamespace>
10 <RootNamespace>MonoPlay</RootNamespace>
11 <AssemblyName>MonoPlay</AssemblyName>
11 <AssemblyName>MonoPlay</AssemblyName>
12 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13 </PropertyGroup>
13 </PropertyGroup>
14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15 <DebugSymbols>true</DebugSymbols>
15 <DebugSymbols>true</DebugSymbols>
16 <DebugType>full</DebugType>
16 <DebugType>full</DebugType>
17 <Optimize>false</Optimize>
17 <Optimize>false</Optimize>
18 <OutputPath>bin\Debug</OutputPath>
18 <OutputPath>bin\Debug</OutputPath>
19 <DefineConstants>DEBUG;TRACE;</DefineConstants>
19 <DefineConstants>DEBUG;TRACE;</DefineConstants>
20 <ErrorReport>prompt</ErrorReport>
20 <ErrorReport>prompt</ErrorReport>
21 <WarningLevel>4</WarningLevel>
21 <WarningLevel>4</WarningLevel>
22 <ConsolePause>false</ConsolePause>
22 <ConsolePause>false</ConsolePause>
23 </PropertyGroup>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25 <DebugType>full</DebugType>
25 <DebugType>full</DebugType>
26 <Optimize>true</Optimize>
26 <Optimize>true</Optimize>
27 <OutputPath>bin\Release</OutputPath>
27 <OutputPath>bin\Release</OutputPath>
28 <ErrorReport>prompt</ErrorReport>
28 <ErrorReport>prompt</ErrorReport>
29 <WarningLevel>4</WarningLevel>
29 <WarningLevel>4</WarningLevel>
30 <Externalconsole>true</Externalconsole>
30 <ConsolePause>false</ConsolePause>
31 </PropertyGroup>
31 </PropertyGroup>
32 <ItemGroup>
32 <ItemGroup>
33 <Reference Include="System" />
33 <Reference Include="System" />
34 </ItemGroup>
34 </ItemGroup>
35 <ItemGroup>
35 <ItemGroup>
36 <Compile Include="Program.cs" />
36 <Compile Include="Program.cs" />
37 <Compile Include="Properties\AssemblyInfo.cs" />
37 <Compile Include="Properties\AssemblyInfo.cs" />
38 </ItemGroup>
38 </ItemGroup>
39 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
39 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
40 <ItemGroup>
40 <ItemGroup>
41 <ProjectReference Include="..\Implab\Implab.csproj">
41 <ProjectReference Include="..\Implab\Implab.csproj">
42 <Project>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</Project>
42 <Project>{F550F1F8-8746-4AD0-9614-855F4C4B7F05}</Project>
43 <Name>Implab</Name>
43 <Name>Implab</Name>
44 </ProjectReference>
44 </ProjectReference>
45 </ItemGroup>
45 </ItemGroup>
46 </Project> No newline at end of file
46 </Project>
@@ -1,32 +1,48
1 using System;
1 using System;
2 using Implab.Diagnostics;
2 using Implab.Diagnostics;
3 using Implab.Parallels;
3 using Implab.Parallels;
4 using Implab;
4 using Implab;
5 using System.Collections.Generic;
6 using System.Collections.Concurrent;
5
7
6 namespace MonoPlay {
8 namespace MonoPlay {
7 class MainClass {
9 class MainClass {
8 public static void Main(string[] args) {
10 public static void Main(string[] args) {
9 if (args == null)
11 if (args == null)
10 throw new ArgumentNullException("args");
12 throw new ArgumentNullException("args");
11
13
12 var listener = new ConsoleTraceListener(true);
14 var q1 = new MTQueue<int>();
13 listener.Subscribe<TraceEvent>();
15 var q2 = new ConcurrentQueue<int>();
16
17 const int count = 10000000;
18
19 var t1 = Environment.TickCount;
14
20
15 MTComponentContainer.AppContainer.Add(listener);
21 for (var i = 0; i < count; i++)
22 q1.Enqueue(i);
16
23
17 TraceLog.StartLogicalOperation("program");
24 var t2 = Environment.TickCount;
25 Console.WriteLine("MTQueue: {0} ms", t2 - t1);
26
27 t1 = Environment.TickCount;
18
28
19 TraceLog.StartLogicalOperation("async");
29 for (var i = 0; i < count; i++)
20 AsyncPool.Invoke(() => {
30 q2.Enqueue(i);
21 TraceLog.TraceInformation("Hello async");
31
22 TraceLog.StartLogicalOperation("foo");
32 t2 = Environment.TickCount;
23 return 0;
33 Console.WriteLine("LinkedList: {0} ms", t2 - t1);
24 })
34
25 .EndLogicalOperation()
35 q2 = new ConcurrentQueue<int>();
26 .Join();
27
36
28 TraceLog.EndLogicalOperation();
37 t1 = Environment.TickCount;
38
39 for (var i = 0; i < count; i++)
40 lock (q2)
41 q2.Enqueue(i);
42
43 t2 = Environment.TickCount;
44 Console.WriteLine("LinkedList+Lock: {0} ms", t2 - t1);
29
45
30 }
46 }
31 }
47 }
32 }
48 }
General Comments 0
You need to be logged in to leave comments. Login now