benchmarking

Benchmarkt socket.io

时光总嘲笑我的痴心妄想 提交于 2019-12-04 08:42:39
问题 I want to benchmark my socket.io server. I want to test how many parallel connections and messages the server can handle. But my socket.io server crash after some minutes when I start the benchmark with about 200 websockets. I tried to use the cluster module of node.js to share the process to the cores. When I use the cluster module some connections become disconnected after some time. The server that I use for the test is a virtual server on the amazon cloud with this properties: 7 GB of

How to really benchmark the memory usage of a Java application

隐身守侯 提交于 2019-12-04 07:56:54
I want to compare different implementations of Java programs in terms of their memory usage efficiency. There are different usage scenarios formulated as JUnit test cases. Actually, all the code is open source at: https://github.com/headissue/cache2k-benchmark The general wisdom to get to the used memory of a Java program is this: Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() , of course it is also possible to use the JMX interface to get these values. However, the determined values of used memory is not reliable. Possible reasons: There may be uncollected garbage

Haskell calculate time of function performing

假装没事ソ 提交于 2019-12-04 07:49:17
i tried to code to calculate time that a function costs list <- buildlist 10000 10000 starttime <- getClockTime let sortedlist = quicksort list endtime <- getClockTime let difftime = diffClockTimes endtime starttime function buildlist: buildlist :: Int -> Int -> IO [Int] buildlist n m = do seed <- getStdGen let l = randomRs (0, m) seed let list = take n l return list function quicksort: quicksort [] = [] quicksort (x:xs) = let head = [a|a<-xs,a<=x] tail = [a|a<-xs,a>x] in quicksort head ++ [x] ++ quicksort tail first question: when i output the difftime, it is always zero no matter how long

Why does linking to librt swap performance between g++ and clang?

亡梦爱人 提交于 2019-12-04 07:41:04
I just found this answer from @tony-d with a bench code to test virtual function call overhead. I checked is benchmark using g++ : $ g++ -O2 -o vdt vdt.cpp -lrt $ ./vdt virtual dispatch: 150000000 0.128562 switched: 150000000 0.0803207 overheads: 150000000 0.0543323 ... I got better performance that his (ratio is about 2), but then I checked with clang : $ clang++-3.7 -O2 -o vdt vdt.cpp -lrt $ ./vdt virtual dispatch: 150000000 0.462368 switched: 150000000 0.0569544 overheads: 150000000 0.0509332 ... Now the ratio goes up to about 70! I then noticed the -lrt command line argument, and after a

Load Testing and Benchmarking With siege vs wrk

吃可爱长大的小学妹 提交于 2019-12-04 07:40:01
问题 I have been looking around for tools that can help me to do load testing and benchmarking. I found couples like: https://github.com/wg/wrk , http://www.joedog.org/siege-home/ , https://github.com/rakyll/boom . I'm wondering if anyone has any experience with these tools and have any feedback pros vs cons of these tools. My load stress will include different test cases using DELETE, PUT, GET, POST... headers Thanks 回答1: I've used wrk and siege, siege is a really easy to use tool, but I'm not

Quantifiable metrics (benchmarks) on the usage of header-only c++ libraries

前提是你 提交于 2019-12-04 07:30:27
问题 I've tried to find an answer to this using SO. There are a number of questions that list the various pros and cons of building a header-only library in c++, but I haven't been able to find one that does so in quantifiable terms. So, in quantifiable terms, what's different between using traditionally separated c++ header and implementation files versus header only? For simplicity, I'm assuming that templates are not used (because they require header only). To elaborate, I've listed what I have

Looking for an accurate way to micro benchmark small code paths written in C++ and running on Linux/OSX

核能气质少年 提交于 2019-12-04 07:06:57
I'm looking to do some very basic micro benchmarking of small code paths, such as tight loops, that I've written in C++. I'm running on Linux and OSX, and using GCC. What facilities are there for sub millisecond accuracy? I am thinking a simple test of running the code path many times (several tens of millions?) will give me enough consistency to get a good reading. If anyone knows of preferable methods, please feel free to suggest them. osgx You can use "rdtsc" processor instruction on x86/x86_64. For multicore systems check the "constant_tsc" capability in CPUID (/proc/cpuinfo in linux) - it

How to invalidate cache when benchmarking?

我怕爱的太早我们不能终老 提交于 2019-12-04 05:25:14
问题 I have this code, that when swapping the order of UsingAs and UsingCast, their performance also swaps. using System; using System.Diagnostics; using System.Linq; using System.IO; class Test { const int Size = 30000000; static void Main() { object[] values = new MemoryStream[Size]; UsingAs(values); UsingCast(values); Console.ReadLine(); } static void UsingCast(object[] values) { Stopwatch sw = Stopwatch.StartNew(); int sum = 0; foreach (object o in values) { if (o is MemoryStream) { var m =

What exactly is number of operations in JMH?

不羁的心 提交于 2019-12-04 04:36:13
The JavaDoc of annotation @OperationsPerInvocation in the Java Microbenchmarking Harness (JMH) states: value public abstract int value Returns: Number of operations per single Benchmark call. Default: 1 Being new to JMH I am wondering what type of operation (byte code operation, assembly code operation, Java operation etc) is meant here. This question naturally refers to all places in JMH (documentation, output, comments etc) where the term 'operation' is used (e.g. " operation/time " unit or "time unit/operation "). In JMH, "operation" is an abstract unit of work. See e.g. the sample result:

Techniques for causing consistent GC Churn

我与影子孤独终老i 提交于 2019-12-04 03:11:00
I'm looking to benchmark how something performs while contending with a high amount of ongoing garbage collection. I've previously benchmarked how it behaves in a stable, single-threaded run, and I'd now like to do the same tests in a more stressed JVM; essentially I'd like to have background threads creating and destroying objects at a reasonably consistent pace. I'm looking for suggestions on how to implement a stable yet GC-intensive operation. It needs to accomplish several goals: Spend a decent amount (say, 20-50%) of time in GC Do an approximately consistent amount of work over time, and