Questions tagged [benchmarking]

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

Filter by
Sorted by
Tagged with
2
votes
0answers
15 views

Benchmarking multiple implementations of a Code Kata: queue for the self-checkout tills at the supermarket

I was reading this question: Why is my function timing out when run with a larger data set? And although I couldn't quite grasp the OP's implementation and so didn't feel like answering. I did some ...
1
vote
1answer
61 views

C - Division from scratch

I wrote this code where division can be done without using C's builtin operator: ...
1
vote
2answers
94 views

Calculating primes: Could this be any faster?

I've ported a prime-number calculation program from primes.pyx to C++ for benchmark purpose. Since I wrote it in C++, I thought that my program would be faster than the original. However, mine took 25....
3
votes
2answers
99 views

Benchmarking insertion sort

More than once I claimed that using binary search doesn't improve performance of the insertion sort. For example, see answer here and comments here). Now I have time to substantiate my claim. The ...
4
votes
1answer
138 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 ...
3
votes
1answer
118 views

A runtime benchmark for multiple programs using the Python subprocess module

I would like feedback on my benchmark script, for use on Linux. What's another method for benchmarking that might be better/easier? Overhead I've found that ...
14
votes
1answer
19k 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 ...
2
votes
3answers
257 views

Merging sorted integer vectors in C++

Given multiple sorted integer vectors, the goal is to merge them into a single vector and eliminate duplicate values. We've already achieved some improvements over the most simple approaches, but ...
10
votes
2answers
190 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 ...
8
votes
1answer
161 views

Measure time and space requirements of different Python containers

I was actually kind of bored and since I'm studying some Python data structures I decided to make some size(MB) and time(secs) comparisons between different containers when conducting the operation of ...
1
vote
0answers
33 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
83 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? ...
16
votes
2answers
4k 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
238 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
461 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
46 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
285 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
73 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
92 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
99 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
10k 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
137 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
7k 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
579 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
131 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
255 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
124 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
71 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
195 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
48 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
1k 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 ...
1
vote
0answers
6k 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
238 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
82 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
68 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
116 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
368 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
244 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 ...
66
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 ...
8
votes
2answers
204 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
63 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
67 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
849 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
72 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
464 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 ...