How to benchmark memory usage of a function?

You can use the jemalloc allocator to print the allocation statistics. For example, Cargo.toml: [package] name = “stackoverflow-30869007” version = “0.1.0” edition = “2018” [dependencies] jemallocator = “0.5” jemalloc-sys = {version = “0.5”, features = [“stats”]} libc = “0.2” src/main.rs: use libc::{c_char, c_void}; use std::ptr::{null, null_mut}; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; extern “C” fn … Read more

What does OpenJDK JMH “score error” exactly mean?

This is the margin of error for the score. In most cases, that is a half of confidence interval. Think about it as if there is a “±” sign between “Score” and “Score error”. In fact, the human-readable log will show that: Result: 1.986 ±(99.9%) 0.009 ops/ns [Average] Statistics: (min, avg, max) = (1.984, 1.986, … Read more

algorithmic trading simulator/benchmark data [closed]

This question is pretty broad; as it is, there is no mention of which instruments you’re interested in. For instance: Stocks Bonds Commodities Forex Derivatives (like Futures or Options) For the moment, I will assume you’re interested in stocks… if so, take a look at Ninja Trader, which offers these features for free. You can … Read more

Testing IO performance in Linux [closed]

IO and filesystem benchmark is a complex topic. No single benchmarking tool is good in all situations. Here is a small overview about different benchmarking tools: Block Storage: IOMeter – Highly customizable and allows to coordinate multiple clients. Needs a Windows PC for the coordination application. Developed by Intel. On Linux, take maximum rates of … Read more

benchmarks: does python have a faster way of walking a network folder?

The Ruby implementation for Dir is in C (the file dir.c, according to this documentation). However, the Python equivalent is implemented in Python. It’s not surprising that Python is less performant than C, but the approach used in Python gives a little more flexibility – for example, you could skip entire subtrees named e.g. ‘.svn’, … Read more

Why is reading one byte 20x slower than reading 2, 3, 4, … bytes from a file?

I was able to reproduce the issue with your code. However, I noticed the following: can you verify that the issue disappears if you replace file.seek(randint(0, file.raw._blksize), 1) with file.seek(randint(0, file.raw._blksize), 0) in setup? I think you might just run out of data at some point during reading 1 byte. Reading 2 bytes, 3 bytes … Read more

Is it possible to force an existing Java application to use no more than x cores?

It’s called setting CPU affinity, and it’s an OS setting for processes, not specific to Java. On Linux: http://www.cyberciti.biz/tips/setting-processor-affinity-certain-task-or-process.html On Windows: http://www.addictivetips.com/windows-tips/how-to-set-processor-affinity-to-an-application-in-windows/ On Mac it doesn’t look like you can set it: https://superuser.com/questions/149312/how-to-set-processor-affinity-on-os-x

Ruby Benchmark module: meanings of “user”, “system”, and “real”?

These are the same times that the Unix time command or other typical benchmarking tools would report: user: the amount of time spent executing userspace code (i.e.: your code), system: the amount of time spent executing kernel code and real: the “real” amount of time it took to execute the code (i.e. system + user … Read more

What is an idiomatic way to have shared utility functions for integration tests and benchmarks?

Create a shared crate (preferred) As stated in the comments, create a new crate. You don’t have to publish the crate to crates.io. Just keep it as a local unpublished crate inside your project and mark it as a development-only dependency. This is best used with version 2 of the Cargo resolver. For better performance, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)