benchmarking

Why is BufferedReader read() much slower than readLine()?

妖精的绣舞 提交于 2020-12-24 07:57:05
问题 I need to read a file one character at a time and I'm using the read() method from BufferedReader . * I found that read() is about 10x slower than readLine() . Is this expected? Or am I doing something wrong? Here's a benchmark with Java 7. The input test file has about 5 million lines and 254 million characters (~242 MB) **: The read() method takes about 7000 ms to read all the characters: @Test public void testRead() throws IOException, UnindexableFastaFileException{ BufferedReader fa= new

How to run methods in benchmarks sequentially with JMH?

风流意气都作罢 提交于 2020-12-13 05:11:03
问题 In my scenario, the methods in benchmark should run sequentially in one thread and modify the state in order. For example, there is a List<Integer> called num in the benchmark class. What I want is: first, run add() to append a number into the list. Then, run remove() to remove the number from the list. The calling sequence must be add() --> remove() . If remove() runs before add() or they run concurrently, they would raise exceptions because there's no element in the list. That is, add() and

How to run methods in benchmarks sequentially with JMH?

断了今生、忘了曾经 提交于 2020-12-13 05:10:11
问题 In my scenario, the methods in benchmark should run sequentially in one thread and modify the state in order. For example, there is a List<Integer> called num in the benchmark class. What I want is: first, run add() to append a number into the list. Then, run remove() to remove the number from the list. The calling sequence must be add() --> remove() . If remove() runs before add() or they run concurrently, they would raise exceptions because there's no element in the list. That is, add() and

Couchbase benchmark reveals very slow INSERTs and GETs (using KeyValue operations); slower than persisted MySQL data

只谈情不闲聊 提交于 2020-12-06 05:57:50
问题 I did a small benchmark test to compare Couchbase (running in Win) with Redis and MySql (EDIT: added Aerospike to test) We are inserting 100 000 JSON "documents" into three db/stores: Redis (just insert, there is nothing else) Couchbase (in-memory Ephemeral buckets, JSON Index on JobId) MySql (Simple table; Id (int), Data (MediumText), index on Id) Aerospike (in-memory storage) The JSON file is 67 lines, about 1800 bytes. INSERT: Couchbase: 60-100 seconds (EDIT: seems to vary quite a bit!)

Why are these Javascript for loops significantly slower on Firefox then Chrome / Safari?

怎甘沉沦 提交于 2020-12-01 09:56:19
问题 I was messing around with the benchmark site jfprefs and created my own benchmark at http://jsperf.com/prefix-or-postfix-increment/9. The benchmarks are variations of Javascript for loops, using prefix and postfix incrementors and the Crockford jslint style of not using an in place incrementor. for (var index = 0, len = data.length; index < len; ++index) { data[index] = data[index] * 2; } for (var index = 0, len = data.length; index < len; index++) { data[index] = data[index] * 2; } for (var

How to calculate the execution time of an async function in JavaScript?

蹲街弑〆低调 提交于 2020-11-28 04:51:14
问题 I would like to calculate how long an async function ( async / await ) is taking in JavaScript. One could do: const asyncFunc = async function () {}; const before = Date.now(); asyncFunc().then(() => { const after = Date.now(); console.log(after - before); }); However, this does not work, because promises callbacks are run in a new microtask. I.e. between the end of asyncFunc() and the beginning of then(() => {}) , any already queued microtask will be fired first, and their execution time

How to calculate the execution time of an async function in JavaScript?

左心房为你撑大大i 提交于 2020-11-28 04:50:42
问题 I would like to calculate how long an async function ( async / await ) is taking in JavaScript. One could do: const asyncFunc = async function () {}; const before = Date.now(); asyncFunc().then(() => { const after = Date.now(); console.log(after - before); }); However, this does not work, because promises callbacks are run in a new microtask. I.e. between the end of asyncFunc() and the beginning of then(() => {}) , any already queued microtask will be fired first, and their execution time

Can 1 CUDA-core to process more than 1 float-point-instruction per clock (Maxwell)?

橙三吉。 提交于 2020-11-27 02:00:23
问题 List of Nvidia GPU - GeForce 900 Series - there is written that: 4 Single precision performance is calculated as 2 times the number of shaders multiplied by the base core clock speed. I.e. for example for GeForce GTX 970 we can calculate performance: 1664 Cores * 1050 MHz * 2 = 3 494 GFlops peak (3 494 400 MFlops) This value we can see in column - Processing Power (peak) GFLOPS - Single Precision. But why we must multiple by 2 ? There is written: http://devblogs.nvidia.com/parallelforall

Can 1 CUDA-core to process more than 1 float-point-instruction per clock (Maxwell)?

南笙酒味 提交于 2020-11-27 01:55:35
问题 List of Nvidia GPU - GeForce 900 Series - there is written that: 4 Single precision performance is calculated as 2 times the number of shaders multiplied by the base core clock speed. I.e. for example for GeForce GTX 970 we can calculate performance: 1664 Cores * 1050 MHz * 2 = 3 494 GFlops peak (3 494 400 MFlops) This value we can see in column - Processing Power (peak) GFLOPS - Single Precision. But why we must multiple by 2 ? There is written: http://devblogs.nvidia.com/parallelforall

Can 1 CUDA-core to process more than 1 float-point-instruction per clock (Maxwell)?

柔情痞子 提交于 2020-11-27 01:55:05
问题 List of Nvidia GPU - GeForce 900 Series - there is written that: 4 Single precision performance is calculated as 2 times the number of shaders multiplied by the base core clock speed. I.e. for example for GeForce GTX 970 we can calculate performance: 1664 Cores * 1050 MHz * 2 = 3 494 GFlops peak (3 494 400 MFlops) This value we can see in column - Processing Power (peak) GFLOPS - Single Precision. But why we must multiple by 2 ? There is written: http://devblogs.nvidia.com/parallelforall