Questions tagged [benchmarking]

Questions about code that is primarily intended to measure the execution time of code

Filter by
Sorted by
Tagged with
1
vote
0answers
29 views

Benchmarking k-shortest path algorithms in Java without JMH

In this post, I have the demo driver that benchmarks two \$k\$-shortest path algorithms. The entire GitHub project is here. net.coderodde.graph.kshortest.Demo <...
2
votes
0answers
42 views

Mutex lock benchmark

I'm trying to measure how many CPU cycles a mutex lock takes. Can you find any problems in my mutex lock benchmark? ...
8
votes
2answers
163 views

Associating degrees with notes of scales

I have a JS file that creates an object with notes from a music scale when given a key (aka tonic/ note). The code works and does what I want it to do. I need a critique on the way it's written, what ...
4
votes
1answer
123 views

State logger for optimization problems

I am working on a C++ project for solving a class of optimization problems. The project will be header-only, and for now, I would like to stay with C++11 (so, not fold-expressions). To be able to ...
14
votes
2answers
3k views

VBA Code Profiling

I have wanted a way to do code profiling in VBA for quite some time. It becomes very complicated to figure out what methods are actually being executed for how long and how often in complex Access ...
3
votes
1answer
175 views

A rather accurate VBA stopwatch

Intro Related, related I'm trying to come up with a neat, accurate way of timing VBA code, as I'm yet to find a method to do this in VBA directly (without plugins etc.) The general idea was to ...
3
votes
1answer
118 views

Golang HTTP requests

I'm beginning to learn about Golang and I would like to have some advice about the following program. ...
1
vote
1answer
37 views

A simple Java class for implementing code stop watches - follow-up

I have received a nice answer for this post. Now, it is my attempt for some improvement: ...
1
vote
1answer
57 views

A simple Java class for implementing code stop watches

(The next iteration: A simple Java class for implementing code stop watches - follow-up) Here is my attempt at more convenient benchmarking (yes, this time I am aware of JVM warmup, etc.), and it ...
4
votes
1answer
205 views

A header only class for C++ time measurement

I wrote a header only class (actually there is a second one for data bookkeeping and dumping) to measure the execution time of a C++ scope without worrying too much about boilerplates. The idea being ...
3
votes
0answers
52 views

Cumulative profiler for a function

I have created a cumulative profiler, meaning it runs a function several times in a row and prints the cumulative profiler results. it's python >= 3.6 specific, but you can remove ...
2
votes
1answer
70 views

Java League of Legends ping checker

I'm still a freshman and this one of my first projects I made using Java and Swing. The program is a simple League of Legends multi-threaded ping checker that pings the server 10 times to get an ...
3
votes
0answers
48 views

Cache line versus struct size testing

There's a mission-critical ring buffer in production on which I'm curious to test some optimizations. Specifically, I'm wondering how much of a performance difference struct size will make on issues ...
3
votes
1answer
83 views

Monitor asynchronous tasks, tracking their running times

Scenario: I'm getting requests through a (thread-safe) queue. Each request then needs to be handled in a separate thread. There is a chance that the function (which is actually calling a Java-program ...
5
votes
1answer
8k views

Python internet speed testing

I understand there are a few similar tools available for testing speed but that's not what I'm looking for. I'm looking at seeing how long it takes to request a site's HTML. However, I'm getting ...
3
votes
3answers
131 views

Write the running time to file without capturing the program's output

I want to run an application and write (append) its processing time into a file. Also, I want to see the stdout and stderr output on the shell, but don't want to write it in a file. After running the ...
5
votes
3answers
4k views

Measuring method execution time

I want to easily measure method's execution time. Of course instead of doing something like this: ...
7
votes
2answers
555 views

Code to track execution time for each function in a class

Problem Statement I want to be able to look at log files and figure out where the bottlenecks are in the code in an easy/visual way rather than trying to do the math every time I make some ...
7
votes
1answer
101 views

Implementing and benchmarking Radix Sort on unsigned integers

Introduction I implemented a restricted version of the sorting algorithm, the one that works only with unsigned integers. I wanted to try using ...
7
votes
1answer
238 views

Computing function time in C++

I used the std::chrono library for computing the timing of a function and need some review on it. Here is the code: ...
5
votes
1answer
104 views

General purpose code performance measurement on Windows

Growing more and more concerned about the real-world performance, especially the execution time, of my code (not just from the perspective of Complexity theory) I decided to build a performance ...
1
vote
2answers
63 views

Middleware Django statistics

I have this middleware to log the number of queries, the time spent on each view and some errors and tracebacks. This will be called on each request, so I had to put a 75ms timeout. I don't like it, ...
3
votes
1answer
140 views

Code runs Speed Test CLI using the python wrapper and then stores values within CSV

I wanted to make use of the speedtest-cli while also incorporating pandas into the project. My initial goal, which I am posting here, was to take the values of the speed test and incorporate them into ...
4
votes
2answers
5k views

Function for timing executions (inspired by MATLAB tic toc)

Inspired by MATLAB's tic/toc I've written a short helper function for calculating execution time. ...
6
votes
1answer
104 views

Benchmarking efficient inversion counting algorithms in Java

Given an array \$A = (a_1, a_2, \dots, a_n)\$, the number of inversions in \$A\$ is the number of index pairs \$i,j\$ (\$i < j\$) such that \$a_i > a_j\$. We can find the number of inversions in ...
3
votes
1answer
47 views

Timing word-searching code in Python

I'm using a linear search as a spell checker. I need to time my code to get averages as I'm using different searches and comparing them. However I don't believe the code I've used to time the code is ...
10
votes
1answer
733 views

Measuring the clock rate of an Intel CPU in C++

I created a short program to directly measure the clock rate of an Intel CPU. It runs, sleeps for a duration specified by the user, and then measures the number of clock cycles and the amount of time ...
2
votes
0answers
4k views

Fuzzy c Means in Python

This is my implementation of Fuzzy c-Means in Python. In the main section of the code, I compared the time it takes with the sklearn implementation of kMeans. ...
3
votes
0answers
206 views

Iterative pandas row additions and row dropping

I have written a program that uses pandas dataframes to quickly access and filter data (DNA strings). Come to find out, pandas ...
4
votes
2answers
77 views

Measuring typing speed in terminal without a mistake

I tend to dislike my code. It's always a mess. I can't critique my own code though, because I just turn it into another mess. I've been programming slightly better every year, but this year it has ...
7
votes
1answer
62 views

Basic profiler - Python

I have created a simple profiler in Python, but I feel like there are better ways to do some things. Terminology: Section - a block of code to profile Label - A name for a section to be used as a ...
6
votes
2answers
111 views

Concatenating prefix of one array with the reversed suffix of another array

Given two arrays and two indices, I need to concatenate the prefix of the first array and the reversed prefix of the second array. For example: ...
7
votes
1answer
298 views

C++ benchmark v2

The purpose of the code is to simplify benchmarking of arbitrary functions. The reason I want to benchmark things is that I would like to get a "feeling" of performance. Although the framework leans ...
2
votes
3answers
238 views

Measuring time spent between two points in code

I'm working on a project where I'm instrumenting how long it takes to get from one point in my code to another. I've written an LLVM pass that instruments the IR with calls to a simple timing library ...
11
votes
1answer
12k views

Decorator to measure execution time of a function

This decorator adds the elapsed time to a function's attributes when applied. My concerns: Is the code pythonic? Could this code be useful? Should I just use the ...
62
votes
4answers
10k views

Send a tweet to ISP when internet speed drops

I have written an app in Python 3 which monitors internet speed and will send a tweet to an ISP when the speed drops too low. The app has a config file where the ISP and target speeds can be ...
7
votes
2answers
190 views

A port of a simple logger

I'm looking at porting a simple logger I wrote a while back in Python to a language which would result in less runtime overhead from logging. As an informal benchmark, I try to log a message, ...
3
votes
0answers
53 views

Time calculation for NLTK tagging

I am trying to calculate the time required to tag one sentence/file by one trained NLTK HMM Tagger. To do this I am writing the following code, please suggest if I need to revise anything here. ...
3
votes
1answer
65 views

Loading components on startup, with timing measurements

I was just wondering, is there a way to load these better and log the times they each took? It seems like a headache having to write about 90+ stopwatches, which is what I will have to do as I have ...
2
votes
1answer
663 views

Matlab tic and toc commands implemented in C++

I need to time a few functions that I'm implementing, so I decided to implement a way of timing even multiple or sub calls based on the stack data structure and on the ...
2
votes
2answers
70 views

Benchmark of Perfect Numbers

I wrote a piece of code to benchmark the detection of perfect numbers up to 10000. The original code is here, in C: ...
2
votes
0answers
459 views

Get process max memory usage while copying large data

I want to check the memory usage of a process before and after I copy a large file or folder, and also, I want to get the maximum memory usage during file operation. Is this a good method? ...
2
votes
0answers
45 views

Python function that returns statistics based on copy file action

I wrote a function that returns a dictionary with statistics (memory usage, time, speed) based on another function that copies files/folders. I want to check if this is a good method or if you have ...
1
vote
1answer
82 views

Measuring CPU frequency in *nix

I have this small function for reading the TSC (time-stamp counter) in *nix. Using it seems to report my CPU frequency more or less correctly. ...
2
votes
1answer
207 views

Benchmark switch, binary search and if-else

Just for curiosity I have done some benchmark for testing the best performance between switch, binary-search, and if-else statement. here is the code : ...
2
votes
1answer
1k views

Multithreaded bottom up merge sort

Before I tried this, my impression was that (bottom up) merge sort would be memory (actual RAM) bound, and not affected much by multithreading, but a 4 thread sort is about 3.0 times as fast as a ...
3
votes
1answer
120 views

Abstract graphing-and-timing functions

I like to use timeit to measure performance of small, and sometimes big, functions. However it can be uncertain as to what the 'actual' time to execute the function ...
1
vote
1answer
140 views

Benchmarking copy semantics vs. move semantics

I am still in the process of learning modern C++, and decided to write this dummy program for actually benchmarking copy semantics vs. move semantics: ...
11
votes
1answer
1k views

Scanner in Scala

I wanted to implement Java's Scanner in Scala. The goal for this class is to: Implement a Scala collection interface (probably ...
4
votes
2answers
1k views

Benchmarking inline vs normal functions in C++

I am currently learning C++ and have learnt about inline functions and how they can give a performance benefit. How could this be improved? ...