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
6 votes
1 answer
63 views

Optimizing __getitem__ for a bioinformatics script in Python

I'm writing a script for a bioinformatics application in Python that iterates through several sequences looking for amino acids in specific positions to calculate their frequency in relation to a ...
Eduardo Menotti's user avatar
2 votes
1 answer
68 views

NLP pre-processing function optimization as it is extremely low on 92Mb data set

I have a data set that is of 300,000 rows approximately and two columns, each row contains a string, some might be larger than others. All in all, the data set in a ...
Louis's user avatar
  • 121
4 votes
2 answers
425 views

Spatial radius search in Boid simulation

I am working on a Boid simulation with 10,000 boids. I've successfully utilized geometry shaders and an array<GLfloat[3], MAX_BOIDS> for vertices to enhance ...
nowox's user avatar
  • 1,015
3 votes
1 answer
81 views

Pentomino solver in Python

When I was a child, I used to play Ubongo board game, recently I discovered Pentomino puzzle and I wanted to create a custom solver in python for it. Here is what I got: ...
Riomare's user avatar
  • 31
1 vote
0 answers
54 views

My code.org Game Lab project is running really slowly, how can I optimize the code further?

I'm working on my final project, and it is a game made with Java Script in code.org's Game Lab. The code worked fine, and it was not slow at all, but as I worked on it, it became much slower! The ...
Renier Jr.'s user avatar
0 votes
0 answers
18 views

matching generic items

Hello fellow developers I was wondering if anyone, with more understanding of javascript, is able to detect some potential flaws or performance issues with this recursive function. It works as ...
Lwtsde's user avatar
  • 1
3 votes
2 answers
255 views

Trailing Digits

https://www.acmicpc.net/problem/23204 I've solved a programming challenge where you need to count the occurrences of a specific digit at the end of the product of multiples of a given number within a ...
qleoz12's user avatar
  • 141
1 vote
5 answers
156 views

Finding a distinct triplet where the sum of the values is divisible by a given number

Given an array a and a number d, I want to count the number of distinct triplets (i,j,k) such that i<j<k and the sum aᵢ + aⱼ + aₖ is divisible by d. Example: when a is ...
Athul Raju's user avatar
4 votes
0 answers
149 views

Optimizing a Wordle Solver in JavaScript

I have written a Wordle solver in JavaScript. The solver generates a decision tree. For each word, it generates all possible feedbacks patterns for that word, it then selects for each pattern the word ...
Cortex's user avatar
  • 440
0 votes
3 answers
67 views

another Merge Sort

I've tried to implement merge sort in c with varying degrees of success, one was correctly sorting the array but leaking memory, one was neither sorting the array and leaking memory. The following was ...
Voiceroy's user avatar
  • 103
0 votes
2 answers
139 views

Python: Detect if a number is divisible by any number in a list

I am trying to filter steps such that it only contains numbers from 1 to step_size that aren't divisible by factors of ...
3StepsTooFar's user avatar
4 votes
2 answers
115 views

Python (API requests)

I'm somewhat new to python and I'm creating a script that requests to a certain API and then uses the response to populate a ...
Aldimar J's user avatar
0 votes
1 answer
64 views

Distance on a unit grid

I have a code that calculates Euclidean distance on a grid with border crossing or without that. ...
popcorn's user avatar
  • 103
1 vote
0 answers
51 views

3ph 2l inverter simulation with SPWM

Here is a code for a simple model of three phase two level inverter with constant DC voltage source and three phase RL load. ...
ppinha's user avatar
  • 21
3 votes
1 answer
195 views

Project Euler 60: Prime Pair Sets

Project Euler Prime Pair Sets: The primes 3, 7, 109, and 673 are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 ...
peternish's user avatar
0 votes
0 answers
68 views

C# chess engine performance

I am creating my own bitboard chess engine in C#. I am trying to optimize my make move, unmake move, and move generating functions to get a good fast base. My C# skills are average and got some tips ...
eligolf's user avatar
  • 109
3 votes
1 answer
63 views

Multi producer/consumer lock-free queue

I would be grateful if you could review my code for a multi producer/consumer lock-free queue in C++. I am mainly after performance improvements, but all input is welcome. ...
Mr. Orange's user avatar
3 votes
1 answer
215 views

Find the closest named color

I have a .json file with name (string) and RGB (r, g, b: numbers) with 30.000 key-value pairs. I am looping the json multiple times per second to find the closest name to a given RGB color. Any idea ...
Relik8's user avatar
  • 31
0 votes
1 answer
183 views

How to optimize the player movement code like in Tomb Of The Musk game?

I've written some code that performs movement similar to the Tomb Of The Musk game. The idea is that the objet should move in a certain direction until it encounters an obstacle. After that, the ...
Hanvil's user avatar
  • 3
7 votes
2 answers
1k views

Convert 64-bit Gray code to integer

This algorithm encodes a 64 bit integer. As input I have a 64 bit integer a, for example: (a is a single 64 bit number,which I split in 8 bytes for readability) <...
tutizeri's user avatar
  • 173
2 votes
1 answer
106 views

calculate the number of ways to pick two different indices

I'm working on a codesignal practice problem You are given an array of integers a and an integer k. Your task is to calculate the number of ways to pick two different indices i < j, such that a[i] ...
Josh's user avatar
  • 21
2 votes
5 answers
416 views

Optimisation: Fastest way to multiply every number in an array by 2

I'm trying to find the fastest way to multiply every element in an array by a given number, in this case 2. So far I have written a SIMD instruction that performs at 33 ns multiplying every number in ...
Henners2002's user avatar
0 votes
0 answers
180 views

Value at Risk forecast generator

I am developing a code to compute Value at Risk (VaR) using various models (see below). Currently, I am looking to implement a rolling window approach over a dataset spanning 4,000 days, with each ...
Oscar's user avatar
  • 1
3 votes
4 answers
1k views

Merging sorted integer arrays (without duplicates)

I have written a Python function called merge_arrays which takes two lists and returns the new list merge without duplicate. The function works as expected, but my ...
XM01 - stands with Palestine's user avatar
1 vote
1 answer
178 views

Function that finds the exact number of times a string appears in a text

So I was tasked with providing a function that returns how many exact occurrences of attribute word appear in attribute text. The goal is for the function to be as fast as possible, and I managed to ...
Jules Raschilas's user avatar
1 vote
1 answer
94 views

Haskell code optimization for short Pi approximator

Very new in Haskell, as a first easy program I went for an old algorithm of mine to approximate pi by counting points within a circle. The snippet below is what I could get working. I had quite an ...
Tsaras's user avatar
  • 137
2 votes
1 answer
117 views

OrderBook Implementation - Follow up

This is a follow up to my previous implementation: The input is of the format ...
Avengerx9's user avatar
2 votes
2 answers
149 views

Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values

Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science ...
Nate Anderson's user avatar
1 vote
1 answer
84 views

Code that performs 2500 simulations by running a regression after randomly assigning 10 friends to each observation in a data took 20 days to run

I am running the following code to conduct a simulation. I have a dataset of around 100K observations. The simulation does the following: It randomly assign 10 "friends" to each observation ...
Joe's user avatar
  • 11
1 vote
0 answers
78 views

Electro-thermal simulation

I'm working on an electro-thermal simulation with variable parameters. Model require the calculation of all the electrical and thermal quantities at each time step, between a starting and ending time. ...
ppinha's user avatar
  • 21
2 votes
1 answer
36 views

Implementing an improved merge sort that uses insertion sort, with "levels" - Would this work correctly?

We were asked to improve the merge sort algorithm by introducing insertion sort to the code. We have been tasked with doing this by utilising a "levels" logic. Here is the exact description ...
Preatorius's user avatar
2 votes
0 answers
29 views

Inputting a list of unique numbers in Scratch

So I am working on recreating a hidden minigame from PvZ Brutal Mode EX+/Unnamed Mod in Scratch for fun here. While I am making some considerable progress on it, I'm having trouble simplifying the ...
CrSb0001's user avatar
  • 183
3 votes
3 answers
191 views

Extracting records from a 2D List of strings

Recently I had an interview question about extracting records that matched certain criteria from a 2D List of strings. The premise was a CSV file was parsed into a ...
Dragonrage's user avatar
6 votes
1 answer
134 views

Exponentiation in Scratch

This was back when I was new to coding on Scratch (as in the case of coding projects entirely from scratch) around 7-8 months ago with my Cookie Clicker in Scratch project that I made pretty much ...
CrSb0001's user avatar
  • 183
4 votes
2 answers
421 views

Continuously Monitoring ICY Stream Metadata (Title, Artist)

This script is called every minute, but I want it to run continuously instead of making that many requests to the radio station and I think that urllib.request can ...
x0tester0x's user avatar
1 vote
1 answer
94 views

considering only the instants of trading with the relative price avoiding stale returns

in my MATLAB code I describe a model for price formation with stale returns in this framework there are 2 type of trader: informed traders who always trade in the "right direction" and noise ...
V013's user avatar
  • 13
0 votes
0 answers
136 views

3D Game Engine Using Turtle

I am making a 3d Game Engine named t3d using Python's turtle module. Here is the code: ...
Tumo Konnin's user avatar
6 votes
1 answer
115 views

One or more planets to line up with the earth a certain amount of times

I have attempted the below question, however my solution is too slow (i.e. It does not fit the 2 second time constrain for java). How can the solution be optimised? While at IOI 2020 in Singapore, ...
Zareef Akoodie's user avatar
11 votes
2 answers
2k views

Faster chess engine in python (with move ordering algorithm?)

I, an amateur coder, have been trying to code a chess engine with python as part of a larger research project. I started by following this tutorial (turns out creator of said tutorial has a github of ...
pjq42's user avatar
  • 211
2 votes
0 answers
28 views

Efficient code to move a node under another while keeping all HierarchyId's as integers and sequential

I'm playing around with an app that will need to read Hierarchy trees quickly but will seldom modify them once created. I've chosen to use HierarchyIds with Entity Framework to model the hierarchy. I ...
Luke's user avatar
  • 21
1 vote
1 answer
96 views

Leetcode: Maximum score from performing multiplication operations

I am looking for feedback on how to make my code more performant (take less time) - specifically with a top-down approach. My specific asks are: How can I make this code faster? It currently takes ...
skittish's user avatar
1 vote
1 answer
51 views

Find all combinations of two companies grouped by the projects they are tendering for

I am working on the task to get all possible combinations (pairs) of ID's (companies) which participated in one bid and create a new data frame with ID_1, ID_2, matching parameter (tender ID). I have ...
Vasya_Ch's user avatar
0 votes
0 answers
15 views

specify a policy for allowing access to a table through a foreign key

Consider the following two tables in a PostgreSQL database: ...
Nathan Osman's user avatar
3 votes
1 answer
89 views

Performance of this BCrypt lossless compressor

The following code compresses a 60-byte BCrypt MCF into 40 bytes. Does anyone see room for performance or other optimizations? For example, I should replace Guava's ...
Oliver's user avatar
  • 93
0 votes
0 answers
35 views

Testing the cost of boxing in System.Reactive Observables

I was curious whether boxing impacts performance in a long chain of IObservable<T> operators where T is a value type, and ...
Kevin Krumwiede's user avatar
8 votes
8 answers
3k views

Can I lessen the use of boolean flag variables in this snippet?

Below snippet is part of a game application's logic and the Update function is called every frame (about 60 times a second). ...
Mukul Kumar's user avatar
2 votes
3 answers
568 views

Count the number of triplets from an array with sums divisible by 'd'?

I got this question on my test and I did the only logical thing I could think of, which is run 3 nested loops and count each triplet. I obviously wouldn't pass test cases for large arrays... How can I ...
evirac's user avatar
  • 23
0 votes
1 answer
41 views

Aggregate transactions in slips

I wrote code to aggregate transactions in slips. I'm concerned with the performance of my code because it uses 3 loops that are nested so the time complexity will be cubic. This code won't scale well ...
bit's user avatar
  • 143
8 votes
3 answers
2k views

Algorithm "sort except zero"

Task: Sort the integers in sequence in sequence. But the position of zeros should not be changed. Input: List of integers (int). Output: List or another Iterable (tuple, generator, iterator) of ...
Глеб's user avatar
  • 183
1 vote
1 answer
75 views

Getting one company from two tables [closed]

Currently I'm working with fastapi, sqlalchemy to connect to multiple databases. It checks params to ensure it has company_name, ...
g3tl0st's user avatar
  • 111

1
2 3 4 5
154