benchmarking

Is there a better way to benchmark a C program than timing?

左心房为你撑大大i 提交于 2019-12-04 02:53:30
问题 I'm coding a little program that has to sort a large array (up to 4 million text strings). Seems like I'm doing quite well at it, since a combination of radixsort and mergesort already cut the original q(uick)sort execution time in less than half. Execution time being the main point, since this is what I'm using to benchmark my piece of code. My question is: Is there a better (i. e. more reliable) way of benchmarking a program than just time the execution? It kinda works, but the same program

How to measure IOPS for a command in linux?

别等时光非礼了梦想. 提交于 2019-12-04 01:32:12
I'm working on a simulation model, where I want to determine when the storage IOPS capacity becomes a bottleneck (e.g. and HDD has ~150 IOPS, while an SSD can have 150,000). So I'm trying to come up with a way to benchmark IOPS in a command (git) for some of it's different operations (push, pull, merge, clone). So far, I have found tools like iostat, however, I am not sure how to limit the report to what a single command does. The best idea I can come up with is to determine my HDD IOPS capacity, use time on the actual command, see how long it lasts, multiply that by IOPS and those are my IOPS

timing block of code in Python without putting it in a function

北慕城南 提交于 2019-12-04 00:29:29
I'd like to time a block of code without putting it in a separate function. for example: def myfunc: # some code here t1 = time.time() # block of code to time here t2 = time.time() print "Code took %s seconds." %(str(t2-t1)) however, I'd like to do this with the timeit module in a cleaner way, but I don't want to make a separate function for the block of code. thanks. interjay You can do this with the with statement. For example: import time from contextlib import contextmanager @contextmanager def measureTime(title): t1 = time.clock() yield t2 = time.clock() print '%s: %0.2f seconds elapsed'

Why is List<>.OrderBy LINQ faster than IComparable+List<>.Sort in Debug mode?

放肆的年华 提交于 2019-12-04 00:14:44
I was interested in whether it would be faster to sort my classes using LINQ, or by implementing the IComparable interface and List.Sort. I was quite surprised when the LINQ code was faster. To do the test, I made a very simple class with the not-so-apt name of TestSort, implementing IComparable. class TestSort: IComparable<TestSort> { private int age; private string givenName; public int Age { get { return age; } set { age = value; } } public string GivenName { get { return givenName; } set { givenName = value; } } public TestSort(int age, string name) { this.age = age; this.givenName = name;

Hazelcast vs. Ignite benchmark

不羁岁月 提交于 2019-12-03 23:47:26
I am using data grids as my primary "database". I noticed a drastic difference between Hazelcast and Ignite query performance. I optimized my data grid usage by the proper custom serialization and indexes, but the difference is still noticeable IMO. Since no one asked it here, I am going to answer my own question for all future references. This is not an abstract (learning) exercise, but a real-world benchmark, that models my data grid usage in large SaaS systems - primarily to display sorted and filtered paginated lists. I primarily wanted to know how much overhead my universal JDBC-ish data

Is that benchmark reliable - aiohttp vs requests

可紊 提交于 2019-12-03 20:36:12
We are trying to chose between technologies at my work. And I thought I'd run a benchmark using both libraries (aiohttp and requests). I want it to be as fair / unbiased as possible, and would love a look from the community into this. So this is my current code : import asyncio as aio import aiohttp import requests import time TEST_URL = "https://a-domain-i-can-use.tld" def requests_fetch_url(url): with requests.Session() as session: with session.get(url) as resp: html = resp.text async def aio_fetch_url(url): async with aiohttp.ClientSession() as session: async with session.get(url) as resp:

fastest way to get Min from every column in a matrix?

自作多情 提交于 2019-12-03 19:52:39
问题 What is the fastest way to extract the min from each column in a matrix? EDIT: Moved all the benchmarks to the answer below. Using a Tall, Short or Wide Matrix: ## TEST DATA set.seed(1) matrix.inputs <- list( "Square Matrix" = matrix(sample(seq(1e6), 4^2*1e4, T), ncol=400), # 400 x 400 "Tall Matrix" = matrix(sample(seq(1e6), 4^2*1e4, T), nrow=4000), # 4000 x 40 "Wide-short Matrix" = matrix(sample(seq(1e6), 4^2*1e4, T), ncol=4000), # 40 x 4000 "Wide-tall Matrix" = matrix(sample(seq(1e6), 4^2

Is the Julia language really as fast as it claims?

我只是一个虾纸丫 提交于 2019-12-03 19:13:15
问题 Following this post I decided to benchmark Julia against GNU Octave and the results were inconsistent with the speed-ups illustrated in julialang.org. I compiled both Julia and GNU Octave with CXXFLAGS='-std=c++11 -O3' , the results I got: GNU Octave a=0.9999; tic;y=a.^(1:10000);toc Elapsed time is 0.000159025 seconds. tic;y=a.^(1:10000);toc Elapsed time is 0.000162125 seconds. tic;y=a.^(1:10000);toc Elapsed time is 0.000159979 seconds. -- tic;y=cumprod(ones(1,10000)*a);toc Elapsed time is 0

Can someone please explain what these ApacheBench results mean?

隐身守侯 提交于 2019-12-03 18:32:25
问题 i'm trying to figure out how to use ApacheBench and benchmark my website. I installed the default site project (it's ASP.NET MVC but please don't put stop reading if u're not a .NET person). I didn't change anything. Add new project. Set confuration to RELEASE. Run without Debug. (so it's in LIVE mode). Yes, this is with the built in webserver, not the production grade IIS or Apache or whatever. So here's the results :- C:\Temp>ab -n 1000 -c 1 http://localhost:50035/ This is ApacheBench,

How can I find the missing value more concisely?

旧城冷巷雨未停 提交于 2019-12-03 18:26:28
问题 The following code checks if x and y are distinct values (the variables x , y , z can only have values a , b , or c ) and if so, sets z to the third character: if x == 'a' and y == 'b' or x == 'b' and y == 'a': z = 'c' elif x == 'b' and y == 'c' or x == 'c' and y == 'b': z = 'a' elif x == 'a' and y == 'c' or x == 'c' and y == 'a': z = 'b' Is is possible to do this in a more, concise, readable and efficient way? 回答1: z = (set(("a", "b", "c")) - set((x, y))).pop() I am assuming that one of the