Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [benchmarking]

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

1
vote
1answer
29 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
55 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 ...
3
votes
0answers
30 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 ...
4
votes
1answer
172 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 ...
2
votes
1answer
56 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
46 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
75 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 ...
7
votes
2answers
527 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
75 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 ...
4
votes
3answers
2k views

Measuring method execution time

I want to easily measure method's execution time. Of course instead of doing something like this: ...
7
votes
1answer
229 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
83 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 ...
3
votes
1answer
91 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 ...
1
vote
2answers
59 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
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
467 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 ...
4
votes
1answer
117 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 ...
2
votes
0answers
3k 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
183 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
69 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
59 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
1answer
100 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 ...
6
votes
2answers
108 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: ...
2
votes
3answers
236 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
9k 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 ...
61
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 ...
3
votes
0answers
50 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. ...
7
votes
1answer
253 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 ...
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 ...
7
votes
2answers
186 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, ...
2
votes
2answers
67 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: ...
3
votes
0answers
430 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 ...
2
votes
1answer
161 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 : ...
3
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
105 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
118 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: ...
2
votes
1answer
551 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 ...
3
votes
2answers
982 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? ...
5
votes
1answer
6k 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 ...
1
vote
0answers
251 views

C++ time profiler

How this code can be improved / simplified ? ...
2
votes
1answer
110 views

measuring the time taken to copy a std stl container

I'm trying to measure the time taken to copy a std::vector<someObject>. Would like to know if this is a correct approach. I tried to do some trivial ...
6
votes
2answers
3k views

Internet Speed Calculator

This program calculates up and downspeed of a given connection for as long as it is running. ...
5
votes
3answers
606 views

Digital root computation with benchmarking

I've read this question about computing the digital root of some integer, and wondered how it would look like in Python. As a reminder, "If you take the digits of any number and add them together, ...
3
votes
3answers
198 views

Helper utilities for easier benchmarking in C

I have this tiny library for measuring the execution time in milliseconds and returning the duration plus the result: execres.h ...
1
vote
0answers
74 views

Micro bench marking using JMH

I am learning to write micro bench marks for Java methods. I read that while writing methods for bench marking we should be careful of writing code which compiler/JVM can optimize. I have writeen my ...
3
votes
1answer
219 views

Testing different implementations of malloc()

Can you help me verify my test result? I'm testing different malloc() implementations with a small program that allocates gigabytes many times: ...
0
votes
2answers
473 views

Effective Python 2/3 two-dimensional array initialisation

Recently I noticed that the idiomatic python two-dimensional array initialisation is extremely slow. I am wondering, is there a good, proper way of doing this simple task fast? Also, are those two ...
3
votes
3answers
128 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 ...
43
votes
3answers
5k views

Benchmarking things in C#

I needed a better way to benchmark code, because, well, rewriting the same benchmarking code every time I need it is just...well...unpleasant. So, here's a class which does just that, it runs an <...