Questions tagged [performance]

Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

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

Create two very similar strings with difference in the middle [closed]

0) Problem / Current Solution I'd like to create two strings that are really similar like this (demo): ...
user avatar
  • 227
2 votes
0 answers
42 views

Python data entry into excel based on equality check with dataframe

My objective is to enter/type in values into Excel cells if the column names and indices match between Excel and dataframe. So, my code does the below Gets the ID values from the dataframe for each ...
user avatar
  • 235
0 votes
1 answer
99 views

Faster way to find items from one list in another one [closed]

I would like to check if a string appears in a list of strings. For that, I have chosen the List<string> type, as follows: ...
user avatar
  • 301
5 votes
3 answers
64 views

Creation & pixel manipulation of 24 bit TARGA

I wrote this code to get familiar with structs in C. It allows the creation and exporting of a 24 bit TGA image and changing the color of individual pixels. My concern is the ...
user avatar
7 votes
0 answers
115 views

Making this python chess engine faster

I've implemented a chess engine using the python chess move generation library (which I assumed to be reasonably fast), and have implemented various optimisation techniques for search and move ...
user avatar
  • 81
2 votes
1 answer
96 views

Auto-fitting text into boxes in matplotlib

Task I tried to code a treemap function in matplotlib, and one of the challenges is auto-fitting text into boxes of different sizes in the treemap, similar to R's package ggfittext. My Code My ...
user avatar
  • 163
0 votes
0 answers
76 views

Load license plate data from Excel

The code below gets data from an Excel spreadsheet and returns some values; this can take up to 15 minutes because the Excel has more than 15 columns and an average of 20,000 rows. ...
user avatar
  • 11
3 votes
1 answer
47 views

Weighted Union-Find class

For a final project I used a weighted union-find and decided to implement it in Python. I wrote it to be as general as possible so it's very portable. I do plan on looking into path compression to ...
user avatar
1 vote
1 answer
56 views

Ising Model simulation in Numpy

I've written this code to simulate the Ising Model. The idea is a system represented as a matrix with each element having value 1 or -1. The input is an initial matrix of 1 and -1; it is then being ...
user avatar
3 votes
1 answer
163 views

Automating shortages report from BOM list in excel but the total run time to output the report is quite slow. Using Excel 2010 - CLOSED

I MIGHT REWRITE THIS QUESTION IN A CLEARER WAY WITH SOME SAMPLES TOO AND POST IT AS ANOTHER SOON, AS NOW MY EXPLAINATION HERE IS QUITE HARD TO UNDERSTAND & MIGHT BE PHRASED WRONG. I do have ...
user avatar
  • 55
3 votes
1 answer
83 views

Trailing delimiter string splicing, implemented for Lua in C

I've been writing with C for a couple days, so this is a relatively advanced function compared to the simple things I've been doing previously. It's written for the Lua API, but it's still C. ...
user avatar
6 votes
1 answer
365 views

Create an image made of many circles

I have written some Python code for creating an image made of lots of circles. It works, but I wonder if it could be made faster, shorter or more pythonic somehow. Example image (took 28 seconds): <...
user avatar
2 votes
1 answer
115 views

Parse a log file into separate column files

This is a follow-up to https://stackoverflow.com/questions/71194832/converting-json-based-log-into-column-format-i-e-one-file-per-column . My task is to optimize this code whose function is to convert ...
user avatar
3 votes
3 answers
96 views

Replace string with another string in C

I have written a program that replaces a given c-string with another c-string. My code works well with small files but takes too much time while working with large files (50 Megabytes and larger). ...
user avatar
0 votes
1 answer
59 views

importing excel data by matching and performing lookups

This code imports data from a separate sheet and matches it based on Column E's data, it does this for every cell then offsets to the next one (622*6) times. If there are any substitutions for vlookup ...
user avatar
1 vote
2 answers
139 views

JavaScript to click a button after a random number of seconds?

I'm trying to optimize my JavaScript code to be a short as possible (this is just for fun). Any thoughts would be appreciated! Basically, the script automatically clicks an "I'm still here" ...
user avatar
6 votes
2 answers
1k views

Entropy of String in C

I have written a C program that calculates Shannon entropy for a C-String (const char *). It works well but in many ...
user avatar
4 votes
2 answers
100 views

Scraping campsite availability from a webpage using vba with selenium

I wrote some code to extract the information from a table, but it takes an extremely long time. The table is in the format of a calendar. I need the information on an Excel sheet with column 1 as the ...
user avatar
  • 41
4 votes
1 answer
135 views

Karatsuba's multiplication

I am working my way through an algorithms course online, and the assignment is to implement Karatsuba's multiplication algorithm. I am also trying to practice C++, so I wanted to implement it in that ...
user avatar
  • 135
6 votes
2 answers
681 views

Huffman coding, using vector<bool>

This is my draft implementation of Huffman encoding & decoding. I'd appreciate any feedback, but have a couple specific questions: I wrote the code assuming vector represents each bool with a ...
user avatar
  • 213
3 votes
1 answer
118 views

C++ program that replaces given color in an image using OpenCV

I have created a C++ program that changes the color of a pixel to another color. But the main feature is that it not only changes 100% accurate colors; instead it matches two colors by using a method ...
user avatar
1 vote
1 answer
80 views

Optimizing performance of string comparison function (particularly interested in redundancies)

I've been working on the below function which compares two input strings and returns a similarity score. I've managed to tweak it down to a level of performance I'm pretty happy with, but I'm ...
user avatar
8 votes
3 answers
799 views

Finding the perfect statline for a roleplaying game using Python

I made a program for fun that tries to roll a perfect statline, i.e a statline with two groups of only 18s, for a role-playing game. I'm still a newbie in python so mainly trying to learn how to make ...
user avatar
0 votes
1 answer
50 views

custom button class for android game engine

I'm a self-taught programmer and I haven't really followed industry-standard coding classes. I'm currently coding my own game engine for android, though and I was wondering if my coding style could ...
user avatar
  • 3
6 votes
2 answers
412 views

C program that finds local acceleration due to gravity (g)

I have written a program in C that calculates local g, by using height from the sea level and latitude. NOTE: I have to add an image of the equation because that ...
user avatar
0 votes
0 answers
36 views

calculating all prime numbers up to a given number

This program calculates all prime numbers up to n. However it runs pretty slowly. I was wondering if there was any optimisations I could make. ...
user avatar
0 votes
1 answer
71 views

Apply a funtion to each element of a dataframe according to other elements values in the corresponding row in pandas and python

I am a little new in the Pandas and Python framework. I would like to understand if my code is more or less fine or it too related to my old program framework way of thinking. I have this is the input ...
user avatar
  • 101
0 votes
0 answers
36 views

Differentiating all the numbers in an array with color codes

Here is a working code for differentiating all the numbers with color codes on an HTML page. How could this code be optimized by using built-In techniques or making use of ECMA Scripts? So that the ...
user avatar
6 votes
1 answer
361 views

Count lengths of constant subarrays

I have an array assuming discrete values. For each value, I am interested in how often it is assumed in a row. For instance, if my array is ...
user avatar
9 votes
1 answer
913 views

Python script to analyse Apache log files

I am fairly new to Python programming language. Most of python programmers have heard the philosophy behind the python programming language. The code should be easy to read, easy to understand, simple,...
user avatar
-1 votes
1 answer
40 views

Mapping variables in two data frames using a third data frame

I have two data frames, df1 and df2 of identical structure. The first three columns, id, <...
user avatar
  • 144
4 votes
1 answer
330 views

Searching for a performance bug in a C++20 pathfinding algorithm (NBA*) - follow up

I have followed some advice in the previous iteration, yet even the current version is too slow compared to the Java implementation of the same algorithm. (C++ version with ...
user avatar
  • 25.7k
0 votes
0 answers
32 views

MNIST classifier and autoencoder: 2 in 1 deal

I built an autoencoder with a latent space of dimension 10 that doubles as a classifier (the predicted digit is the argmax of the latent space). This was obtained by optimizing both the digit ...
user avatar
  • 27.2k
4 votes
1 answer
131 views

Simple parallel compression using Run-length Encoding in C

I encountered the concurrency-zip project in OSTEP By Remzi Arpaci-Dusseau. So basically, I've built a simple compression program that uses Run-length Encoding, and multi-threading in C. But I couldn'...
user avatar
3 votes
1 answer
132 views

Numerical integration in Python involving four dimensions

I'm trying to obtain the following S2 from a given S1, $$ S2(i, j) = \sum _{k=0} ^i \sum _{l=0} ^j S1(k, i-k, j, l) e^{ -\sqrt{...
user avatar
4 votes
1 answer
120 views

Searching for a performance bug in a C++20 pathfinding algorithm (NBA*)

(See the next iteration.) I have this pathfinding algorithm: DirectedGraph.hpp ...
user avatar
  • 25.7k
0 votes
0 answers
13 views

Monthly range locker for Google Sheets

This code is designed to protect monthly ranges in Google Sheets based on time now vs set time (end of month). After the month is locked the Employees/Consultants (Active Users) cannot edit, but the ...
user avatar
4 votes
1 answer
69 views

Optimizing Code for Spectral Gradient algorithm in Python

I am building an algorithm to run proximal spectral gradient for research purposes. The code is almost in its finalized step, but the runtime of the code is slow. I hope to seek your professional ...
user avatar
2 votes
1 answer
88 views

Python functions that calculate first n terms of a given order of Fibonacci sequences

I have written two functions that calculate the first n terms of a given order o of Fibonacci sequence, and return the result as ...
user avatar
7 votes
2 answers
459 views

Median cut algorithm

I have implemented a simple version of the median cut algorithm. It takes a vector of Color structs representing pixel in an image. I also use the ...
user avatar
0 votes
1 answer
65 views

Python - Efficiently pick random data from an array, generate random UUIDs and save it all in an Excel table

I wrote the following prototype: ...
user avatar
  • 195
3 votes
2 answers
117 views

Factor 999999 numbers as fast as possible

My code finds the prime factorization of numbers, ordering the prime numbers from least to greatest. It prints a list of 999999 prime factorizations (which can be changed if you edit the function call ...
user avatar
  • 131
0 votes
0 answers
47 views

How to optimize `push` and `pop` in this tree list algorithm?

So based on this question and answer, which is based on this answer, I have abstracted it out into a reusable module. Basically it is the TLList class, with a ...
user avatar
  • 329
5 votes
0 answers
127 views

Improving performance of radix sort

I am trying to optimize the following (now C) radix sort code for use in my game engine library. The basis for this code was inspired by this youtube video on a C++ implementation called ...
user avatar
4 votes
1 answer
174 views

Minimize memory allocations while calculating the matrix representation of a Hamiltonian

I am writing a script using Julia (calling my functions from the REPL) to compute the matrix representation of certain Hamiltonian. After I run my script I see that the memory allocations count is ...
user avatar
0 votes
1 answer
24 views

Python Socket Class transfer functions for any networking related program

This code is meant to send an object (any object) over a connection to a recieving program. I want to make sure that i haven't made any red flags. It seems to work fine, i've sent tuples with data (...
user avatar
4 votes
2 answers
345 views

Bash-based Port scanner (/dev/tcp)

This question is ideal in my case: Ludisposed's python-scapy-tcp-port-scan-of-subnet - At codereview stackexchange But this is not Scapy; nor Python(it might get used in the future though but that is ...
user avatar
5 votes
1 answer
183 views

Matchsticks game in Python

I made the following game in Python applying object oriented programming and I would like to know if there is something to improve. PS: My native language is Spanish, if you see something wrong ...
user avatar
5 votes
1 answer
478 views

Laser physics simulation

This is for a computation for laser physics. The speed is quite slow, which seems to be delayed a lot by the three nested for loops with indices j,k, and l (with comments below). And the computation ...
user avatar
3 votes
2 answers
353 views

Download entire localStorage as file

I would like to download the entire contents from localStorage to a json file (in a "clear" formatting). I've tried this and it works perfectly. However, ...
user avatar