benchmarking

Why does Method access seem faster than Field access?

独自空忆成欢 提交于 2019-12-05 06:46:21
I was doing some tests to find out what the speed differences are between using getters/setters and direct field access. I wrote a simple benchmark application like this: public class FieldTest { private int value = 0; public void setValue(int value) { this.value = value; } public int getValue() { return this.value; } public static void doTest(int num) { FieldTest f = new FieldTest(); // test direct field access long start1 = System.nanoTime(); for (int i = 0; i < num; i++) { f.value = f.value + 1; } f.value = 0; long diff1 = System.nanoTime() - start1; // test method field access long start2

B-trees, databases, sequential vs. random inserts, and speed. Random is winning

白昼怎懂夜的黑 提交于 2019-12-05 06:12:53
EDIT @Remus corrected my test pattern. You can see the corrected version on his answer below. I took the suggestion of replacing the INT with DECIMAL(29,0) and the results were: Decimal: 2133 GUID: 1836 Random inserts are still winning, even with a fractionally bigger row. Despite explanations that indicate random inserts are slower than sequential ones, these benchmarks show they are apparently faster. The explanations I'm getting aren't agreeing with the benchmarks. Therefore, my question remains focused on b-trees, sequential inserts, and speed. ... I know from experience that b-trees have

cpu_get_usage in php?

﹥>﹥吖頭↗ 提交于 2019-12-05 06:12:14
I have created a benchmark class that allows the user to insert for example $timer->checkpoint('1'); to check out some code for time,memory consumption and such.... and at the end of the code if she/he wants to test it she/he has to insert $result=$timer->result(); this gives out some data to public function result() like e.g. memory usage (using memory_get_peak_usage) and time consumption (microtime()). This all works just fine for me. But how can I use the combination of existing built-in php functions to get a value that can be considered a CPU consumption ? It has been quite easy to

How to write a pointer-chasing benchmark using 64-bit pointers in CUDA?

与世无争的帅哥 提交于 2019-12-05 05:57:18
This research paper runs a series of several CUDA microbenchmarks on a GPU to obtain statistics like global memory latency, instruction throughput, etc. This link is the link to the set of microbenchmarks that the authors wrote and ran on their GPU. One of the microbenchmarks called global.cu gives the code for a pointer-chasing benchmark to measure global memory latency. This is the code of the kernel that is run. __global__ void global_latency (unsigned int ** my_array, int array_length, int iterations, int ignore_iterations, unsigned long long * duration) { unsigned int start_time, end_time

Why does the call latency on clock_gettime(CLOCK_REALTIME, ..) vary so much?

旧城冷巷雨未停 提交于 2019-12-05 05:07:28
I'm trying to time how long clock_gettime(CLOCK_REALTIME,...) takes to call. "Back in the day" I used to call it once at the top of a loop since it was a fairly expensive call. But now, I was hoping that with vDSO and some clock improvements, it might not be so slow. I wrote some test code that used __rdtscp to time repeated calls to clock_gettime (the rdtscp calls went around a loop that called clock_gettime and added the results together, just so the compiler wouldn't optimize too much away). If I call clock_gettime() in quick succession, the length of time goes from about 45k clock cycles

Is there a way to pass parameters to GET request using wrk?

拟墨画扇 提交于 2019-12-05 04:56:26
问题 I need to benchmark a REST API that takes parameters as input. I wondering if there is a way to do it using wrk . Right now I don't see such an option: user@Ubuntu-K56CA:~/wrk$ ./wrk Usage: wrk <options> <url> Options: -c, --connections <N> Connections to keep open -d, --duration <T> Duration of test -t, --threads <N> Number of threads to use -s, --script <S> Load Lua script file -H, --header <H> Add header to request --latency Print latency statistics --timeout <T> Socket/request timeout -v,

How to send more than one query string in Apache Bench?

半世苍凉 提交于 2019-12-05 03:48:21
ab -n 1 -c 1 http://localhost:2020/welTo.do?pxtId=3000007937&superDo=jack I got answer for first query string but i also get 'superDo' is not recognized as an internal or external command, operable program or batch file. Please help me TIA Regards thiru You probably just need to quote the URL to avoid shell special characters from being interpreted. In this case your & symbol is causing the text to the left to be run in the background while attempting to run superDo as a command. ab -n 1 -c 1 'http://localhost:2020/welTo.do?pxtId=3000007937&superDo=jack' user551168 There are two workarounds

shade for parameter resource: Cannot find 'resource' in class org.apache.maven.plugins.shade.resource.ManifestResourceTransformer

馋奶兔 提交于 2019-12-05 01:59:11
I'm working on a maven project. I'm trying to integrate jmh benchmarking into my project. The pom.xml of my maven project... <parent> <groupId>platform</groupId> <artifactId>platform-root</artifactId> <version>3.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>platform-migration</artifactId> <packaging>jar</packaging> <name>Platform Migration</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compile.source>1.7</maven.compile.source> <maven.compile.target>1.7</maven.compile.target> <jmh.version>1.1.1</jmh.version>

Understanding Ruby on Rails render times

怎甘沉沦 提交于 2019-12-05 01:39:13
I am working on an "optimization" on my application and I am trying to understand the output that rails (version 2.2.2) gives at the end of the render. Here is the "old" way: Rendered user/_old_log (25.7ms) Completed in 466ms (View: 195, DB: 8) | 200 OK And the "new" way: Rendered user/_new_log (48.6ms) Completed in 337ms (View: 192, DB: 33) | 200 OK These queries were exactly the same, the difference is the old way is parsing log files while the new way is querying the database log table. The actual speed of the page is not the issue (the user understands that this is a slow request) ... but

How to benchmark Node.js streams?

怎甘沉沦 提交于 2019-12-05 01:11:43
问题 How can I benchmark streams in Node.js? I've tried benchmark.js: var fs = require('fs'); var Transform = require('readable-stream').Transform; var util = require('util'); var Benchmark = require('benchmark'); var suite = new Benchmark.Suite; // my super uppercase stream function Uppercase(options) { if (!(this instanceof Uppercase)) return new Uppercase(options); Transform.call(this, options); } Uppercase.prototype = Object.create( Transform.prototype, { constructor: { value: Uppercase }});