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
11
votes
3answers
1k views

My blit function for my own graphics library

Here is a blit function for a graphics library I made. I've built a small graphics library that uses an palette-indexed spritesheet to hold all of the game's sprites. The blit function copies parts of ...
2
votes
0answers
74 views

Fetch in JavaScript, but less messy?

I'm trying to separate the fetch logic from the component, but, due to the nature of async/await functions I have to write an async function to call other async function and I wanted to know if that's ...
2
votes
0answers
41 views

Convolution layer using numpy in python

I'm trying to make a CNN in python using numpy. I have a finished product but it seems that it can be improved. On testing the convolutional layer is the biggest bottleneck ...
3
votes
2answers
225 views

Parsing custom text file using haskell

I am working on writing code for find difference between two text files that should be ideally same. the format of file is ...
0
votes
0answers
30 views

Graph Theory Amortized Analysis

I created some code to represent a graph. There are two functions to operate on the graph. The first which uses a list of nodes, determines if there is a key in a graph. The second which uses an ...
0
votes
0answers
17 views

nested drop down for blog posts

I wrote this component to be a drop down for blog posts. The index prop is a PostIndex object returned from a query in the ...
4
votes
1answer
68 views

Convert ASCII representations of phonetics to Unicode characters

Here is some working code for converting an input string to an output string: ...
1
vote
1answer
61 views

Accelerating creation of matrices and finding ways for optimal scaling

I have the following specific task, for which I have written code, in Rcpp, but it doesn't scale well and I would like to improve it. I'll describe first the steps of the procedure Step 1: We have ...
0
votes
0answers
56 views

Find the number of different submasses in a weighted string

I'm using a site similar to SPOJ (in Portuguese, so I don't think linking it will help), where I need to find the number of different submasses in a given weighted string. Through the use of an ...
2
votes
2answers
84 views

Finding pair of numbers that minimize a function

This is a problem of a past bioinformatic contest (requires an account). My solution works but is too slow for some test cases. Input format The first line of the input contains one integer \$T\$, \$(...
3
votes
2answers
65 views

Javascript best way to filter out empty values and simplify reusable function

Hello I have this function that takes array of objects and takes a specific value from the object and creates array of strings that can make mapped to dropdown selector. ...
1
vote
1answer
51 views

Automatic notification system about changes to court cases

I have written an application for lawyers' offices. There is an API to fetch info about court cases. I have implemented API calls for front end when user enters particular case; one tab is filled with ...
1
vote
3answers
154 views

Count prime numbers whose rotations are all prime

This code solves Project Euler problem 35: The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes ...
1
vote
1answer
61 views

Checking if two shapes collide in TypeScript (double dispatch)

Basically, I'm trying to create a generic way to check if two shapes are colliding. I think this is kind of a "double-dispatch" problem, but I'm unsure if there is a better way to solve it ...
4
votes
1answer
103 views

More efficient way to create an ASCII maze using box characters

I've written a C# program to generate a random maze, and then draw that maze in the Console mode using box-drawing characters, e.g. ─ │ ┌ ┐ ┬ ┼ etc. It works fine, as below, but I'm not convinced that ...
4
votes
4answers
437 views

HackerRank Sales by Match

This is my first post. I'm switching from Python to Java and I've been practicing on HackerRank for some time. Today I solved this problem in which you have to ...
0
votes
0answers
36 views

Optimize Javascript User Mentioning

I want to replace every div with the class mention. The text should then be parsed and all the parts with ...
1
vote
0answers
31 views

Python 3 script for statistiscal analysis of English vocabulary

This is a Python 3 script that statistically analyzes 105,230 words with a total of 913,935 characters, its results will be used for pseudoword generation purposes. You will need this file for it to ...
1
vote
0answers
11 views

Check if Profile name is contained in Tagged Profile names: added link

I have a function which checks for a profile name and determines if it is in a tagged profile name. ...
2
votes
0answers
47 views

Calculating Probabilities

This code calculates the probability of a runner finishing 3rd and it works like expected. I'm pretty sure though that is woefully inefficient. How could this code be transformed in a much more ...
4
votes
1answer
81 views

Python scripts that generate valid ngrams for use in pseudoword generation

These are the scripts I wrote to generate valid ngrams, the output will be filtered manually then used in Markov chain style pseudoword generation. You will need PowerShell 7 and gcide_xml to make ...
-1
votes
1answer
130 views

Scraping odds portal with beautiful soup

This code scrapes www.oddsportal.com for all the URLs provided in the code and appends it to a dataframe. I am not very well versed with iterative logic hence I am finding it difficult to improvise on ...
1
vote
2answers
110 views

Unsigned 64bit subtract-with-borrow in Standard C++

I'm writing a (compile-time-)fixed-width unsigned big integer. To implement subtraction, a subtract-with-borrow primitive is required. When efficient platform-specific implementation isn't available (...
1
vote
1answer
52 views

Find circles for `f(z, c) = z ^ 2 + c` of length 6 in rational numbers

I've found pretty simple problem on Numberphiles channel: suppose we have a recursive function $$ \begin{equation} \begin{split} f_0 &= Z ^ 2+ C \\ f_i &= f_{i-1}^2 + C \; | \; i = 1 \dots \...
6
votes
1answer
296 views

Python: determine whether one string can be obtained by changing one character in the middle of another string

This script solves a simple problem: Input two strings differ one character or zero characters in length, return true if the following conditions are met: 1, They must start with same character and ...
1
vote
1answer
58 views

Open, writing to, and closing a configuration file, and error checking the process in C

All this does is safely and reliably opens, writes to, and closes the file. Yet there are so many gotos and the code is quite verbose. I am not even sure that all ...
3
votes
2answers
151 views

How to implement a 2D Cellular Automaton in JavaScript?

So far I have this: ...
2
votes
0answers
51 views

How to avoid retracing in tensorflow when predicting scores for inputs with different sizes

I use the following code in order to assess the quality of an audio, which is based on this original-project: MOSNet. I call compute_mosnet_score() in a loop with a ...
4
votes
1answer
158 views

Python PyQt6 populate QTreeWidget with a list of named tuples

This is a Python 3.9 script that pulls data from a MySQL database and converts it to a list of named tuples and then passing it to PyQt6.QTreeWidget. It has to be a ...
3
votes
1answer
51 views

Python script that makes ngrams

This is a Python script that generates ngrams using a set of rules of what letters can follow a letter stored in a dictionary. The output is then preliminarily processed using another script, then it ...
1
vote
1answer
119 views

C++ vector bubble sort in my edition

I made a small adaptive function that sorts vector: ...
2
votes
2answers
69 views

Updated version of my first neural network in c++

I got lot of suggestions for optimizing my neural network last post I made, now I wanted to post updated version of it were I got rid of most of performance eaters, now I would really appriciate ...
2
votes
2answers
166 views

return the sum of the squares that is equal to n²

I'm struggling to solve this Kata. My code works but I can't pass because it's timing out. I have googled it and even tried other people's code but still doesn't pass. Any suggestion on how can I make ...
2
votes
0answers
48 views

Small language, compiles to register VM bytecode

I am trying to implement a small programming language, in Nim, as a way of improving my (close to non-existent) programming skills. The programming language is intended to have IF-GOTO, variables, and ...
1
vote
0answers
58 views

More Efficent Code for Announcment Command in Discord.js

I am creating a command in my discord bot to send an announcement to every server it is in, and this is the only way i could think of doing it, but i know there is a more efficient way of doing it. ...
0
votes
0answers
44 views

Two dimensional bicubic interpolation implementation for dlarray in Matlab

This is a follow-up question for Two dimensional bicubic interpolation implementation in Matlab. While I am working on neural network designing, I want to compare the effects between using padding and ...
1
vote
0answers
21 views

Inserting captions under photographs in word based on entries in excel spreadsheet

I have a macro written in word for transferring captions written in excel to a corresponding photograph in a word document. At the moment it runs however I am finding that it slows down over time the ...
-1
votes
1answer
59 views

Passing a partial application as an argument of an other function with no overhead [closed]

I am trying to find a way to pass a partial application as an argument of an other application with no overhead. I think I have find a way to do it (which might be dirty). The templated structure &...
1
vote
1answer
36 views

tokenize char array with PolarSSL library

I'm trying to perform a decryption operation using RSA. I'm using the PolarSSl library. I have a char array key[] that contains RSA private key like the following, <...
3
votes
1answer
73 views

Java i/o speed less than python i/o while printing an array

Motivation: I was solving an array based i/o problem and encountered Time Limit Errors, it was later found that the code for java ran roughly 10x slower than the ...
2
votes
1answer
46 views

Tiny attempt at a register machine in Nim

I am attempting to learn the Nim language by making a small and simplistic register machine. It is intended to interpret some basic instructions. The entire parsing lexing process consists of ...
1
vote
0answers
90 views

Computing the angle between two vectors (vectorized) for small angles and with few copies

I am implementing a function that computes the angle between two vectors when given two n-dimensional arrays and an axis along which to operate. I want to do this with as few copies as possible, and ...
3
votes
0answers
50 views

Speed Up API Requests & Overall Python Code

I'm not asking for help solving a problem but rather asking for help for possible ways to improve the speed of my program. Essentially what this does is: Tracks market data by pulling the data from ...
3
votes
3answers
95 views

Image Processing Sobel Edge Detection in C

This is a follow-up question for Image Processing Median Filter in C. Under the same tiny bmp image read / write framework, a sobel edge detection function has been performed. The experimental ...
4
votes
2answers
118 views

Merge two pulses if they match

The function processFus() takes : Two lists of pulses (200 000 in each), as an input Two lists of pulse, empty, pulseValid and invalid. The function must fill them ...
0
votes
1answer
21 views

Rotation Management Application

My code works just fine but it seems like I have too many variables which could confuse people from what the code does. Any ideas? Or does this look fine. Feel free to add any other tips to make my ...
5
votes
0answers
177 views

Multithreaded pathfinding in Unity C#

I've tried to implement multithreaded pathfinding in an attempt to increase performance, but if anything, performance seems to actually decrease when I enable multithreading. Is there anything I ...
2
votes
1answer
56 views

Find the most similar pair of rows from a table

I have a list of n cities and hourly weather prediction for each one of them for h hours. I'm writing a script to find a pair of ...
3
votes
2answers
115 views

Python 3 approximate pi using 9 algorithms

Note: this script requires gmpy2, if you are using Python 3.9.5 x64 on Windows 10 21H1 like me, then you need to download the pre-built ...
2
votes
1answer
55 views

Optimizing telegram bot

I was working on one telgram bot, and when finally i made everything i discovered that it is extremely slow. def s takes 5-7 seconds to get result and send it to user, i tried to optimise it with ...

1
3 4
5
6 7
167