コード例 #1
0
		public void ParallelNewVsGet()
		{
			var manager = new MemoryStreamManager(memoryBlockSize);

			var newResults = LoadTest.ExecuteParallelAsync
				(
					"new",
					index =>
					{
						var stream = new MemoryStream(memoryBlockSize);

						stream.Dispose();
					},
					iterationCount,
					4096
				).Result;

			Trace.Write(newResults.ToString());

			var cacheResults = LoadTest.ExecuteParallelAsync
				(
					"get",
					index =>
					{
						var stream = manager.Get();

						manager.Put(stream);
					},
					iterationCount,
					4096
				).Result;

			Trace.Write(cacheResults.ToString());
		}
コード例 #2
0
		public void GetVsNew()
		{
			var manager = new MemoryStreamManager(memoryBlockSize);

			var results = LoadTest.ExecuteCompare
				(
					"Get",
					index =>
					{
						var stream = manager.Get();

						manager.Put(stream);
					},
					"New",
					index =>
					{
						var stream = new MemoryStream(memoryBlockSize);

						stream.Dispose();
					},
					iterationCount
				);

			Trace.Write(results.ToString());
		}