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.

724 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
64 views

Reduce size of minesweeper program to fit in qr code

I saw a guy who fit snake in a qr code and I wanted to do the same thing but with minesweeper. The maximum amount of data a qr code can hold is 3kb. My c program, without any compiler magic, takes up ...
4
votes
0answers
41 views

Fast compression using a thread pool

This is my latest effort on RFC 1951 compression ( the widely-supported compression standard ) in Rust. It uses 2 extra threads to compute the LZ77 matches and the checksum in parallel with the ...
4
votes
0answers
46 views

upload multiple images and resize

I'm written PHP code to upload multiple images to server. this function process maximum 10 images at one time and if the image width or height bigger than 2000px it will be resize , but the code is ...
4
votes
0answers
59 views

Naive Solver of Matrix with Periodic Boundary Conditions Feedback

I am creating an \$O(n)\$ solver for an \$Ax = b\$ system where \$A\$ has the form \$ A = \begin{pmatrix} a_1 & b_1 &&&d_{u}\\ c_1 & a_2 & b_2\\& \ddots & \ddots &...
4
votes
0answers
142 views

Cross-Entropy Minimization - Extreme Code Performance

I'm working on a multivariate cross-entropy minimization model (for more details about it, see this paper, pp. 32-33). It's purpose is to adjust a prior multivariate distribution (in this case, a ...
4
votes
0answers
73 views

3D Direct Convolution Implementation in C

For my project, I've written a naive C implementation of Direct3D convolution with periodic padding on the input. Unfortunately, since I'm new to C, the performance isn't so good. By convention, all ...
4
votes
0answers
42 views

Small Automatic Differentiation Library

Introduction As a programming exercise I recently wrote this automatic differentiation library based on forward accumulation. It should offer a simple way to create mathematical functions whose ...
4
votes
0answers
66 views

Integrator 2.0: A Simple Integrator in C++17

This is a follow up of A simple definite integrator class of a single variable in C++ I took most of the advice from the user: emma-x and some from user: sudo-rm-rf-slash Here is my fully revised ...
4
votes
0answers
66 views

Combine filtered or hidden cells

Purpose of the code: I have 3 Excel files to deal with. Those file have already been filtered or hidden because the content is very large. And I only need part of the content for every excel files. I ...
4
votes
1answer
52 views

Windows autoclicker with a console interface

I have recently started coding in c++ and have made a simple console application. When executed the program asks the user to position their cursor wherever they want continuous repeating clicks, after ...
4
votes
0answers
59 views

Edit Excel through MS Access

I have an Access macro that runs AfterUpdate of a form. It opens an Excel workbook and edits a few cells. I have It working the way I want, but the problem is that ...
4
votes
0answers
62 views

Interacting with PostgreSQL attachment and the file system

I have just migrated from Python 2 to Python 3. I have written the following script to fetch all records of a table, ir_attachment, from PostgreSQL. After fetching all the records I check following ...
4
votes
0answers
69 views

Extracting cycles from directed graph with max degree 1 and then performing set cover on cycles

I'm trying to solve P1243E in an efficient manner. The problem in simple words is: Given \$k\$ boxes, \$i\$-th box with \$n_i\$ numbers. All numbers are distinct. We need to select one number from ...
4
votes
0answers
62 views

Evaluating a previously calculated gradient function

I am trying to perform optimization using a surrogate model instead of the real function and for that, I need the gradient of my LSTM model with respect to the input. In this case, I have 3 features ...
4
votes
0answers
72 views

4×4 cofactor in SSE

The cofactor of a 4×4 matrix can be used to convert a "regular geometry" matrix into the matrix that transforms the normals. It's an alternative to the common inverse-transpose pattern. In this post I ...
4
votes
0answers
258 views

Wait free triple buffer primitive

I'm trying to write a triple buffer that's wait free for a update + render loop after being bitten by lock starvation one too many times (on a different project, using a library). For reference, a ...
4
votes
0answers
151 views

Chess AI Using Minimax and Alpha-Beta Pruning

I am working on a Chess AI using chess.js, and currently, it can run 3 layers in under 10 seconds, but 4 or more takes minutes. How can I optimize my current code to be able to run 4 or 5 layers, or ...
4
votes
0answers
71 views

Butter side up?

I've written a piece of code that determines if a piece toast with butter lands on the butter-side or not, depending on its initial velocity and the table height. The code is written in Mathematica ...
4
votes
0answers
215 views

Move-generation for chess in rust

In the last couple of days I have been programming a chess move generator in Rust from scratch. While it's intent is to be later used in a fully functional engine, where the speed of the move-...
4
votes
0answers
87 views

Collatz Conjecture Disprover Unit - Googol Edition

The Wikipedia article about the Collatz Conjecture has these quotes: If the conjecture is false, it can only be because there is some starting number which gives rise to a sequence that does not ...
4
votes
0answers
46 views

Functional blob counting

I have image files consisting of black and white pixels encoded as RGB8. I want to count the number of blobs i.e. contiguous areas of white pixels. I rewrote this algorithm in haskell. The algorithm ...
4
votes
0answers
148 views

Fast Hardy-Weinberg equilibrium simulation

I was very bored over one of my breaks this year, so I built a Hardy-Weinberg equilibrium simulator for two unrelated alleles of the same gene. Hardy-Weinberg equilibrium is when there is no evolution,...
4
votes
0answers
223 views

Rabbit MQ long running de-queue by using IEnumerable yield return

The following code attempts to efficiently stream queue messages to processing units using an IEnumerable yield return. create a blocking collection to handle the stream create a linked token source ...
4
votes
0answers
592 views

numpy 2d array anti diagonal averaging

The following piece of code averages the ante-diagonal elements of a 2d array x of size (m,n) with, for my purpose, m > n. ...
4
votes
0answers
219 views

An in-memory copy of the GDAX order book for an arbitrary cryptocurrency, updated in real time

GDAX is the cryptocurrency exchange owned and operated by Coinbase. This code is intended to be the basis for an order-book-strategy trading bot. I'd love feedback on my use of data structures, my ...
4
votes
0answers
526 views

Uploading captured video to Google Cloud Storage

My program intends to capture video streams (in mjpeg) with OpenCV and upload the captured frames into Google Cloud Storage for later processing. I am expecting to capture ~15-20 frames per second and ...
4
votes
0answers
318 views

Optimizing Graph Algorithms for Floyd Warshall and Johnson Algorithm

I am trying to implement and compare Floyd Warshall and Johnson Algorithm(for Sparse Graphs). I have written the following code which produces correct output values for the all pair shortest paths. ...
4
votes
0answers
120 views

Algorithm to find connected tiles (percolation)

I wrote a little program in JavaFX which displays a path of neighbouring open tiles going from top to bottom. It should simulate a percolation. The algorithm iterates through the whole grid (every ...
4
votes
0answers
177 views

A* algorithm optimization and implementation

I am implementing the A* algorithm in Python and have successfully completed the task. It works and even spits out the coordinates from the start to the end. However, I am programming a bot for a ...
4
votes
0answers
178 views

Propagation solver in C++ using discrete Hankel transform

I wrote a small program which propagates light pulses using a discrete hankel transformation (based on A quasi-discrete Hankel transform for nonlinear beam propagation, You Kai-Ming et al., 2009. It ...
4
votes
0answers
80 views

Jet Plane Target Lock On

Here is my missile launcher script, and it is in my opinion borderline acceptable code except for how resource expensive it is. I was wondering if anyone could help me write it better so I could learn ...
4
votes
0answers
842 views

Python code to calculate STM CRC32

I have code to calculate STM CRC32 in python. It works well but I'm shocked from time when I see how much it takes. Namely calculating for 5120 bytes takes about 20ms (or even more)! Now I'm thinking ...
4
votes
0answers
416 views

Speed up calculating relative strength index

I am trying to program the calculation of the relative strength index indicator described on a stockcharts.com page. On the same page there are Excel formulas used for calculations. My code below is ...
4
votes
0answers
642 views

Generating Bitly links in a Google Sheet

I have this set of functions in my Google Sheet to create a Bitly bitlink whenever data in a row is changed. While this does work, it seems really slow to me. Looking at the Execution transcript, it ...
4
votes
0answers
246 views

How to make a matrix factorization system recommander faster?

I used and modified a matrix factorization function for a system recommender from quuxlabs.com. It works well for small sized input but when we get to large matrix it takes too much time. I was ...
4
votes
0answers
249 views

Fast ray/triangle intersection code in C

I wonder if someone is familiar with ray/triangle intersection algorithms and can help me optimize them? Here are my implementations of two ray/triangle intersection algorithms in C. The first is the ...
4
votes
0answers
151 views

KMP algorithm searching from the right

The generic version of extension method is aimed to work like String.LastIndexOf which can search t from the last position of <...
4
votes
0answers
117 views

Graph Python challenge 2 (revised)

I'm looking for ways to optimize a function that I wrote as an answer to this problem in Python: You and your rescued prisoners need to get out of this collapsing death trap - and fast! ...
4
votes
0answers
533 views

2D grid container with arbitrary multiple data types

I've been toying with the idea of making a simple game. In game development, it is good to do things in a more struct-of-arrays style rather than arrays-of-structs style, due to cache locality. ...
4
votes
0answers
811 views

Custom animated image control

I have written the following control which allows loading a GIF from embedded resource, file, or raw Image. It allows for more granular control over the direction ...
4
votes
0answers
130 views

Parallel popcount of packed bytes

I want to do a popcount of bytes in an array. Not a total popcount of everything, but lots of little popcounts for every individual byte to determine the neighborhood count in GoL. The following ...
4
votes
0answers
89 views

Protection for cells in Google Sheets

Is there some way to speed this up, since it keeps timing out while running? The spreadsheet is shared with a Google Group with editing permissions. I've loaded what I can into memory but each ...
4
votes
0answers
118 views

Project Euler #14 in Clojure (finding long Collatz sequence chain)

I'm working on a Clojure implementation for Project Euler #14, which asks for the initial element, under 106, that produces the longest collatz-sequence chain. I'm trying to make use of every ...
4
votes
0answers
116 views

Hash Based Data Structure in Java for Collision Calculation

I have started a project on my free time were I'm writing a 2D game engine in Java. One of the more challenging and interesting aspects of such a project is collision detection between sprites on the ...
4
votes
0answers
136 views

Stratified Sampling/Naive Bayesian C++

For my project, I'm required to create three training datasets from a set of about 45000 elements (32000 after cleaning incomplete elements). Each line looks like this: ...
4
votes
0answers
82 views

SLOC Counter Script Optimization

I'm a HPC guy so I'm all about "make it work, then make it fast." I have a little bash script which gets a Physical Source Lines Of Code (PSLOC) and Logical SLOC (currently just of Java code, but it ...
4
votes
0answers
697 views

PowerShell GUI to display information about users

I have a GUI file which is currently being ran by VBS, but I have a few issues: PowerShell v2 is what is being run on every machine and I cant change that, runs very slow on first time launch. it ...
4
votes
0answers
2k views

Web scraping from the Google Play store

I am using this R function to web scrape data from the google play store. Is there a way to increase its efficiency using R? This code takes about 4 seconds for 14 urls with my machine/internet ...
4
votes
0answers
71 views

Comparison of sprite movement implementations

I've come up with two ways to do sprite movement with CreateJS, and I'm wondering if one is better than the other as far as performance and maintainability. The player data is saved in a json file ...
4
votes
0answers
91 views

Minimum amount of edges that needs to be traversed to visit all vertices… or something like that

So I have this problem, where I'm given m connections over n vertices. The vertices are labeled ...

1
2
3 4 5
15