public static void innerQueryOriginalOthersTest(IEnumerable<Product> products) { innerQueryOriginalPLINQ(products); TestingEnvironment.BenchmarkQuery(() => products.AsQueryExpr().Where(p => products.Where(p2 => p2.productName == "Ikura").Select(p2 => p2.unitPrice).Contains(p.unitPrice)).Select(p => p.productName).Compile(), ref products, "Original Ikura with LinqOptimizer", "products.AsQueryExpr().Where(p => products.Where(p2 => p2.productName == \"Ikura\").Select(p2 => p2.unitPrice).Contains(p.unitPrice)).Select(p=>p.productName).Compile()" ); TestingEnvironment.BenchmarkQuery(() => products.AsParallelQueryExpr().Where(p => products.Where(p2 => p2.productName == "Ikura").Select(p2 => p2.unitPrice).Contains(p.unitPrice)).Select(p => p.productName).Compile(), ref products, "Original Ikura with Parallel LinqOptimizer", "products.AsParallelQueryExpr().Where(p => products.Where(p2 => p2.productName == \"Ikura\").Select(p2 => p2.unitPrice).Contains(p.unitPrice)).Select(p=>p.productName).Compile()" ); }
public static void suspendedSingleResultOthersTest(IEnumerable<Product> products) { TestingEnvironment.BenchmarkQuery(() => OptimizerExtensions.AsGroupSuspendedThreadSafe(() => products.AsParallel().Select(p2 => p2.unitPrice).Max()).SelectMany(uMaxThunk => products.AsParallel().Where(p => uMaxThunk.Value == p.unitPrice).Select(p => p.productName)), ref products, "Optimized Max With AsGroupSuspendedSelectMany operator with PLINQ", "OptimizerExtensions.AsGroupSuspendedThreadSafe(() => products.AsParallel().Select(p2 => p2.unitPrice).Max()).SelectMany(uMaxThunk => products.AsParallel().Where(p => uMaxThunk.Value == p.unitPrice).Select(p => p.productName))" ); TestingEnvironment.BenchmarkQuery(() => OptimizerExtensions.AsGroup(() => products.AsQueryExpr().Select(p2 => p2.unitPrice).Run().Max()).AsQueryExpr().SelectMany(uMaxThunk => products.Where(p => uMaxThunk.Value == p.unitPrice).Select(p => p.productName)).Compile(), ref products, "Optimized Max With AsGroupSuspendedSelectMany operator with LinqOptimizer", "OptimizerExtensions.AsGroup(() => products.AsQueryExpr().Select(p2 => p2.unitPrice).Run().Max()).AsQueryExpr().SelectMany(uMaxThunk => products.Where(p => uMaxThunk.Value == p.unitPrice).Select(p => p.productName)).Compile()" ); TestingEnvironment.BenchmarkQuery(() => OptimizerExtensions.AsGroupSuspendedThreadSafe(() => products.AsParallelQueryExpr().Select(p2 => p2.unitPrice).Run().Max()).SelectMany(uMaxThunk => products.AsParallelQueryExpr().Where(p => uMaxThunk.Value == p.unitPrice).Select(p => p.productName).Run()), ref products, "Optimized Max With AsGroupSuspendedSelectMany operator with Parallel LinqOptimizer", "OptimizerExtensions.AsGroupSuspendedThreadSafe(() => products.AsParallelQueryExpr().Select(p2 => p2.unitPrice).Run().Max()).SelectMany(uMaxThunk => products.AsParallelQueryExpr().Where(p => uMaxThunk.Value == p.unitPrice).Select(p => p.productName).Run())" ); }
public static void suspendedSingleExpressionOthersTest(IEnumerable<Product> products) { TestingEnvironment.BenchmarkQuery(() => products.AsParallel().Where(p => OptimizerExtensions.AsGroup(() => Math.Round(p.unitPrice / 1.2, 2)).Select(pup => products.Any(p2 => p2.unitPrice == pup.Value)).First()).Select(p => p.productName), ref products, "Optimized single With AsGroupSuspendedSelectFirst operator with PLINQ", "products.AsParallel().Where(p => OptimizerExtensions.AsGroup(() => Math.Round(p.unitPrice / 1.2, 2)).Select(pup => products.AsParallel().Any(p2 => p2.unitPrice == pup.Value)).First()).Select(p => p.productName)" ); TestingEnvironment.BenchmarkQuery(() => products.AsQueryExpr().Where(p => OptimizerExtensions.AsGroup(() => Math.Round(p.unitPrice / 1.2, 2)).Select(pup => products.Any(p2 => p2.unitPrice == pup.Value)).First()).Select(p => p.productName).Compile(), ref products, "Optimized single With AsGroupSuspendedSelectFirst operator with LinqOptimizer", "products.AsParallelQueryExpr().Where(p => OptimizerExtensions.AsGroup(() => Math.Round(p.unitPrice / 1.2, 2)).Select(pup => products.Any(p2 => p2.unitPrice == pup.Value)).First()).Select(p => p.productName).Compile()" ); TestingEnvironment.BenchmarkQuery(() => products.AsParallelQueryExpr().Where(p => OptimizerExtensions.AsGroup(() => Math.Round(p.unitPrice / 1.2, 2)).Select(pup => products.Any(p2 => p2.unitPrice == pup.Value)).First()).Select(p => p.productName).Compile(), ref products, "Optimized single With AsGroupSuspendedSelectFirst operator with Parallel LinqOptimizer", "products.AsParallelQueryExpr().Where(p => OptimizerExtensions.AsGroup(() => Math.Round(p.unitPrice / 1.2, 2)).Select(pup => products.Any(p2 => p2.unitPrice == pup.Value)).First()).Select(p => p.productName).Compile()" ); }
public static void suspendedInnerQueryOthersTest(IEnumerable<Product> products) { suspendedInnerQueryPLINQ(products); TestingEnvironment.BenchmarkQuery(() => OptimizerExtensions.AsGroup(products.AsQueryExpr().Where(p2 => p2.productName == "Ikura").Select(p2 => p2.unitPrice).Compile()).AsQueryExpr().SelectMany(uThunk => products.Where(p => uThunk.Value.Contains(p.unitPrice)).Select(p => p.productName)).Compile(), ref products, "Optimized Ikura With AsGroupSuspendedSelectMany operator with LinqOptimizer", "OptimizerExtensions.AsGroup(products.AsQueryExpr().Where(p2 => p2.productName == \"Ikura\").Select(p2 => p2.unitPrice).Compile())).AsQueryExpr().SelectMany(uThunk => products.Where(p => uThunk.Value.Contains(p.unitPrice)).Select(p => p.productName)).Compile()" ); TestingEnvironment.BenchmarkQuery(() => OptimizerExtensions.AsGroupSuspendedThreadSafe(products.AsParallelQueryExpr().Where(p2 => p2.productName == "Ikura").Select(p2 => p2.unitPrice).Compile()).SelectMany(uThunk => products.AsParallelQueryExpr().Where(p => uThunk.Value.Contains(p.unitPrice)).Select(p => p.productName).Run()), ref products, "Optimized Ikura With AsGroupSuspendedSelectMany operator with Parallel LinqOptimizer", "OptimizerExtensions.AsGroupSuspendedThreadSafe(products.AsParallelQueryExpr().Where(p2 => p2.productName == \"Ikura\").Select(p2 => p2.unitPrice).Compile()).SelectMany(uThunk => products.AsParallelQueryExpr().Where(p => uThunk.Value.Contains(p.unitPrice)).Select(p => p.productName).Run())" ); }
public static void singleResultOriginalOthersTest(IEnumerable<Product> products) { TestingEnvironment.BenchmarkQuery(() => from Product p in products.AsParallel() where (from Product p2 in products select p2.unitPrice).Max() == p.unitPrice select p.productName, ref products, "Original Max Query Expession with PLINQ", "from Product p in products.AsParallel()\n where (from Product p2 in products select p2.unitPrice).Max() == p.unitPrice\nselect p.productName" ); TestingEnvironment.BenchmarkQuery(() => products.AsQueryExpr().Where(p => products.Select(p2 => p2.unitPrice).Max() == p.unitPrice).Select(p => p.productName).Compile(), ref products, "Original Max Expession with LinqOptimizer", "products.AsQueryExpr().Where(p => products.Select(p2 => p2.unitPrice).Max() == p.unitPrice).Select(p => p.productName).Compile()" ); TestingEnvironment.BenchmarkQuery(() => products.AsParallelQueryExpr().Where(p => products.Select(p2 => p2.unitPrice).Max() == p.unitPrice).Select(p => p.productName).Compile(), ref products, "Original Max Expession with ParallelLinqOptimizer", "products.AsParallelQueryExpr().Where(p => products.Select(p2 => p2.unitPrice).Max() == p.unitPrice).Select(p => p.productName).Compile()" ); }
public static void singleExpressionOriginalOthersTest(IEnumerable<Product> products) { TestingEnvironment.BenchmarkQuery(() => products.AsParallel().Where(p => products.Any(p2 => p2.unitPrice == Math.Round(p.unitPrice / 1.2, 2))).Select(p => p.productName), ref products, "Original single Lambda Expession with PLINQ", "products.AsParallel().Where(p => products.AsParallel().Any(p2 => p2.unitPrice == Math.Round(p.unitPrice / 1.2, 2))).Select(p => p.productName)" ); TestingEnvironment.BenchmarkQuery(() => products.AsQueryExpr().Where(p => products.Any(p2 => p2.unitPrice == Math.Round(p.unitPrice / 1.2, 2))).Select(p => p.productName).Compile(), ref products, "Original single Lambda Expession with LinqOptimizer", "products.AsQueryExpr().Where(p => products.Any(p2 => p2.unitPrice == Math.Round(p.unitPrice / 1.2, 2))).Select(p => p.productName).Compile()" ); TestingEnvironment.BenchmarkQuery(() => products.AsParallelQueryExpr().Where(p => products.Any(p2 => p2.unitPrice == Math.Round(p.unitPrice / 1.2, 2))).Select(p => p.productName).Compile(), ref products, "Original single Lambda Expession with Parallel LinqOptimizer", "products.AsParallelQueryExpr().Where(p => products.Any(p2 => p2.unitPrice == Math.Round(p.unitPrice / 1.2, 2))).Select(p => p.productName).Compile()" ); }