benchmarking

Ackermann very inefficient with Haskell/GHC

ぐ巨炮叔叔 提交于 2019-11-29 20:34:49
I try computing Ackermann(4,1) and there's a big difference in performance between different languages/compilers. Below are results on my Core i7 3820QM, 16G, Ubuntu 12.10 64bit , C: 1.6s , gcc -O3 (with gcc 4.7.2) int ack(int m, int n) { if (m == 0) return n+1; if (n == 0) return ack(m-1, 1); return ack(m-1, ack(m, n-1)); } int main() { printf("%d\n", ack(4,1)); return 0; } OCaml: 3.6s , ocamlopt (with ocaml 3.12.1) let rec ack = function | 0,n -> n+1 | m,0 -> ack (m-1, 1) | m,n -> ack (m-1, ack (m, n-1)) in print_int (ack (4, 1)) Standard ML: 5.1s mlton -codegen c -cc-opt -O3 (with mlton

How can I find the missing value more concisely?

两盒软妹~` 提交于 2019-11-29 20:22:32
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? z = (set(("a", "b", "c")) - set((x, y))).pop() I am assuming that one of the three cases in your code holds. If this is the case, the set set(("a", "b", "c")) - set((x, y)) will consist

How fast is Berkeley DB SQL compared to SQLite?

折月煮酒 提交于 2019-11-29 20:20:40
Oracle recently released a Berkeley DB back-end to SQLite . I happen to have a hundreds-of-megabytes SQLite database that could very well benefit from "improved performance, concurrency, scalability, and reliability", but Oracle's site appears to lack any measurements of the improvements. Has anyone here done some benchmarking? Mike Owens I participated in the beta evaluation of the BDB SQLite code and one of the things I tried to get a handle on was the performance difference. At this point, I cannot publish exactly what I found until I have at least one other person evaluate my code, run the

How to benchmark functions in Clojure?

…衆ロ難τιáo~ 提交于 2019-11-29 20:17:05
I know I can get the time take to evaluate a function can be printed out on the screen/stdout using the time function/macro. The time macro returns the value of the evaluated function, which makes it great to use it inline. However I want to automatically measure the runtime under specific circumstances. Is there a function which returns the elapsed time in some library to help with this benchmarking? You might want to look into Hugo Duncan's benchmarking library for Clojure -- Criterium . From the README: Criterium measures the computation time of an expression. It is designed to address some

What is the best way to measure execution time of a function? [duplicate]

走远了吗. 提交于 2019-11-29 19:04:27
This question already has an answer here: Is DateTime.Now the best way to measure a function's performance? 15 answers Obviously I can do and DateTime.Now.After - DateTime.Now.Before but there must be something more sophisticated. Any tips appreciated. ctacke System.Environment.TickCount and the System.Diagnostics.Stopwatch class are two that work well for finer resolution and straightforward usage. See Also: Is DateTime.Now the best way to measure a function’s performance? High resolution timer in .NET Environment.TickCount vs DateTime.Now What’s the best way to benchmark programs in Windows?

Large public datasets? [closed]

一个人想着一个人 提交于 2019-11-29 19:02:32
I am looking for some large public datasets, in particular: Large sample web server logs that have been anonymized. Datasets used for database performance benchmarking. Any other links to large public datasets would be appreciated. I already know about Amazon's public datasets at: http://aws.amazon.com/publicdatasets/ 1. Large sample web server logs that have been anonymized. These work to start with: UCI Machine Learning Repository Anonymous Microsoft Web Data MSNBC.com Anonymous Web Data Syskill and Webert Web Page Ratings There are many, many more data sets available than these (see the

Why is Go so slow (compared to Java)?

偶尔善良 提交于 2019-11-29 18:58:36
As we could see from The Computer Language Benchmarks Game in 2010: Go is on average 10x slower than C Go is 3x slower than Java !? How can this be, bearing in mind that Go compiler produces native code for execution? Immature compilers for Go? Or there is some intrinsic problem with the Go language? EDIT: Most answers deny intrinsic slowness of Go languge, claiming the problem resides in immature compilers. Therefore I've made some own tests to calculate Fibonacci numbers : Iterative algorithm runs in Go (freebsd,6g) with the same speed as in C (with O3 option). The dull recursive one runs in

Load Testing with AB … fake failed requests (length)

自古美人都是妖i 提交于 2019-11-29 18:43:59
To do some load testing, for my own curiosity, on my server I ran: ab -kc 50 -t 200 http://localhost/index.php This opens up 50 keep-alive connections for 200 seconds and just slams my server with requests for index.php In my results, I get: Concurrency Level: 50 Time taken for tests: 200.007 seconds Complete requests: 33106 Failed requests: 32951 (Connect: 0, Receive: 0, Length: 32951, Exceptions: 0) Write errors: 0 Keep-Alive requests: 0 Total transferred: 1948268960 bytes HTML transferred: 1938001392 bytes Requests per second: 165.52 [#/sec] (mean) Time per request: 302.071 [ms] (mean) Time

ab load testing

浪子不回头ぞ 提交于 2019-11-29 18:32:33
Can someone please walk me through the process of how I can load test my website using apache bench tool ( ab )? I want to know the following: How many people per minute can the site handle? Please walk me through the commands I should run to figure this out. I tried every tutorial, and they are confusing. Mamsaac The apache benchmark tool is very basic, and while it will give you a solid idea of some performance, it is a bad idea to only depend on it if you plan to have your site exposed to serious stress in production. Having said that, here's the most common and simplest parameters: -c : (

Obtaining CPU thread usage in Java

筅森魡賤 提交于 2019-11-29 18:32:13
问题 I have a question around getting CPU utilization for a given JNI block. I'm making some intensive CPU computation in the underlying C++ JNI native method. I'm in the process of optimizing this computation and want to benchmark it against varying inputs. I need some guidance on how to go about measuring this. The alternatives I have considered so far are Using JMX ThreadMXBean to measure system CPU usage for the current thread that invokes call into JNI method. However, I am not sure if JNI