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

Codewars Runtime Error

I am currently trying to solve the problem "Is my friend cheating?" on Codewars. The Text are the Details to the Problem: A friend of mine takes the sequence of all numbers from 1 to n (...
user avatar
5 votes
1 answer
158 views

Monte-carlo simulation code - simple exercise

I created a quick monte-carlo simulation which seems to do what I want (simple version below). The code basically simulates a Poisson distribution, say this results in a simulation of ...
user avatar
  • 53
-1 votes
2 answers
70 views

Speed up before/after refresh subs

I have the following VBA subs that run before and after query refresh. However, it's taking quite a while to run through the code (about 20 seconds or so from clicking 'Refresh All' to being able to ...
user avatar
4 votes
1 answer
115 views

Binary Thread Scheduler

The term, I used, binary thread scheduler means a scheduler that orders the execution of two threads for two tasks that has a specific dependency. Rather than using some mathematical expressions to ...
user avatar
  • 411
0 votes
0 answers
74 views

How can I make this code more efficient

i try to get the row count for last three column (Kindly refer the below image ).I have done using for loop but the concern is it takes so much of time to execute in my application, and i heard apply ...
user avatar
0 votes
1 answer
66 views

2 ConvertToBase3 methods with great disparity of execution time

I have two methods to do the same thing: convert a number to ternary. ...
user avatar
  • 109
3 votes
2 answers
429 views

Print square numbers from 1 to 9999 (non-tradfn)

I'm making a simple program that outputs the squares. I have a question: Is there a way to improve the speed but make the Code readable? Code ...
user avatar
1 vote
2 answers
135 views

group countries by language in JavaScript

I need a better implementation than the below code (O(N) Solution), I am grouping countries by language ( data ) is the countries JSON, each country could have 0, 1 .. or more language as the object ...
user avatar
1 vote
1 answer
121 views

print 10x10 random numbers from 1 to 3 table

The code below will print a 10x10 table of random numbers between 1-3. Is there something to make the code faster? Can the code be made more readable? ...
user avatar
5 votes
1 answer
148 views

Processing binary data in Rust

I have binary files that need to be efficiently processed. The first 8 bytes correspond to metadata, and all the rest is data. From the first 8 bytes I need the last 4 bytes to determine how to ...
user avatar
  • 384
1 vote
2 answers
251 views

sum of array using multithreading

I implement sum element of array using multi threading but my question is when my program work with one thread the time is better than using 6 thread . I am using a CPU with 8 threads.What am I wrong <...
user avatar
1 vote
3 answers
172 views

SQL query joining applications to categories

I do have large database and my query takes about 2s to complete on production environment which is kinda slow and would like to ask is there a space for improvement? My initial inputs are ...
user avatar
  • 119
2 votes
1 answer
101 views

Display routine for Minesweeper on PyQT5

I'm trying to recreate minesweeper in python with PyQT5. I have this function that updates the GUI by using nested for loops (one for column, and one for row) to check each cell in a 19x19 area to ...
user avatar
1 vote
2 answers
64 views

Binary Search using recursive approach

Is the following implementation of recursive function correct? How about the time complexity of the code; is it good in terms of performance? ...
user avatar
0 votes
1 answer
33 views

Gradient with interactive background

I'm coding this starry background for a website using p5.js, and it has 3 elements: There is a background that slowly intervals between black and white. This is ...
user avatar
3 votes
1 answer
185 views

(Google Foobar XOR Checksum Challenge) How do i optimize this function to run for much larger values?

I wrote a function that accepts 2 integers start and length as input and returns the bitwise XOR of certain numbers as described below: ...
user avatar
5 votes
1 answer
59 views

Exploring the space of 8 parameters of a physics problem to then be evaluated in ODE integrator as LSODA millions of times, efficently

there's a function in one of the scripts I've been working on that I really want to improve. Disclaimer: Being honest, I'm not really very good at programming but I've been learning day to day and it'...
user avatar
  • 163
1 vote
2 answers
86 views

Radix Sort function

I am working with this assignment of optimizing a radix sort code in C++ and I need to reduce the execution time. My code is working and it looks like this: ...
user avatar
0 votes
0 answers
45 views

SQLite loses performance versus SQL server and powershell regarding LEFT JOIN (INTERSECT)

I have the following files in a directory: 1256590_hashed.txt 1273301_hashed.txt 1177301_hashed.txt ... etc... these represent cut and hashed segments of documents ...
user avatar
  • 1
-3 votes
1 answer
57 views

Is this snippet of code following all the best practices? The code is intended to capitalize the first letter of a word

How can I improve this so that it follows all the best practices? ...
user avatar
4 votes
1 answer
1k views

Reading from large binary files

I am reading data out of some large (~2GB each) binary files; these have a well defined structure: ...
user avatar
1 vote
1 answer
164 views

Optimize Leetcode 239. Sliding Window Maximum using Swift

LeetCode problem 239. Sliding Window Maximum You are given an array of integers nums, there is a sliding window of size k which ...
user avatar
1 vote
0 answers
81 views

maximum total reward of a game

The code is an attempted divide and conquer method of finding the maximum total reward of a game where each turn two adjacent numbers in an arbitrary list are multiplied by each other to create a ...
user avatar
-1 votes
2 answers
92 views

Optimization suggestions for my Stack [closed]

stack.hpp ...
user avatar
2 votes
0 answers
77 views

Maximizing Efficiency of Collatz Conjecture Program Python

My question is very simple. I wrote this program for pure entertainment. It takes a numerical input and finds the length of every Collatz Sequence up to and including that number. I want to make it ...
user avatar
  • 21
3 votes
1 answer
100 views

Efficiently calculating perfect powers in Haskell

I'm trying to calculate perfect powers to solve this code wars challenge: https://www.codewars.com/kata/55f4e56315a375c1ed000159/haskell The number 81 has a special property, a certain power of the ...
user avatar
3 votes
0 answers
162 views

Advent of Code 2021, Day 3 in Haskell

This is a working solution to today's Advent of Code puzzle, written in Haskell. However, I feel like this solution is not optimal. ...
user avatar
  • 131
0 votes
0 answers
35 views

Improving multiple row creation query in JavaScript

I'm trying to create multiple rows in my db with an array. This array has multiple objects of products chosen by the client. ...
user avatar
5 votes
1 answer
71 views

Find the mean magnitude of values inside unit circle

I'm fairly new to Python and am exploring how to fix functions and make code 'more effective and readable'. As a first step, I would want to try to make shorter snippets of code here - for example by ...
user avatar
  • 51
1 vote
0 answers
99 views

String search using Rabin-Karp algorithm

I am trying to solve a needle in haystack using Rabin-Karp algorithm, but for large inputs my code takes way too long time. Here is the part which apparently is too slow: ...
user avatar
  • 111
1 vote
1 answer
59 views

Absolute Permutation | Hacker Rank: Any way to make this python code faster without changing it's whole logic?

https://www.hackerrank.com/challenges/absolute-permutation/problem I know that if you work out the math and logic first, the algorithm can be simplified greatly (shifting indices), but is that the ...
user avatar
3 votes
1 answer
92 views

Machine Learning Loss Functions In C++

I was looking for C++ versions of the machine learning metrics implemented in Python's sklearn, but they were surprisingly hard to find. I came across a website that had most of the loss functions ...
user avatar
4 votes
2 answers
267 views

Remove matching lines from all files

I have written a Python3 program that looks for matching strings and removes them from files. ...
user avatar
0 votes
0 answers
24 views

Given Array and 2 ints return the smallest distance between based on index

...
user avatar
10 votes
2 answers
1k views

Multi-threaded web server serving HTML, images, etc

I have a web server that can send websites, images, mp3 and other things and I was wondering how I could improve the code and make the server more efficient. ...
user avatar
4 votes
3 answers
158 views

Improving generic A* algorithm performance

Here is my A* algorithm. I tried hard to implement it generically, but come up only with one idea to use lambdas for heuristic and next nodes (neighbours / successors) functions. I know that using ...
user avatar
  • 51
2 votes
2 answers
88 views

Shunting Yard Calculator - Extended to negative, complex, etc

This project is based off the shunting yard algorithm and has additional features such as negative value parsing. It's like a scientific calculator. I am looking to improve this project by getting rid ...
user avatar
  • 31
6 votes
3 answers
430 views

Count the numbers in a range in which the sum of the odds digits have the same parity of the evens one

As already written in the title I want to count the numbers in the range (x+1, y) where x and y are integers, in which the sum of the digits in odd places have the same parity of the ones in even ...
user avatar
  • 163
1 vote
0 answers
36 views

OCaml implementation of two-sum

I'm implementing some simple algorithms (e.g. two-sum) in OCaml and I am unsure why my OCaml solution is running much slower than the equivalent Python version. My OCaml version: ...
user avatar
  • 11
0 votes
0 answers
22 views

Updating an array inside a document using Mongoose and ExpressJS

The following is a put controller I wrote to update a document. What I am updating is a particular array in the Model: The issues array. The schema for the Model is ...
user avatar
  • 101
1 vote
0 answers
86 views

In a search of perfect batch script for editing the hosts file

I want to edit Windows hosts file in the best way for the end user, using a batch-only solution. I ended up with this script, which works fine, but since I don't have enough knowledge, the syntax is ...
user avatar
  • 11
2 votes
2 answers
546 views

Sum of 2 arrays using multi threading

I'm trying to implement sum of 2 array using multi threading. I expected that when I use more threads it will be faster than when I use one thread, but that isn't the case. ...
user avatar
1 vote
1 answer
149 views

Python IPv6 verifier, parser and converter

This is a simple Python 3 program that verifies whether a string is a valid IPv6 address or not, parses IPv6 address to its hexadecimal and decimal values, and converts an integer to IPv6 format. I am ...
user avatar
0 votes
1 answer
173 views

Find the minimal distance between two values in an array [closed]

Given 2 values and an array, I must return the minimal distance between the indices of both values, as efficiently as I can in terms of run time and space. This is my solution: ...
user avatar
2 votes
0 answers
111 views

Evaluate performance of DLL calls from VBA

While playing with a VBA project involving Windows APIs, I have noticed some odd behavior: API calls under Excel 2016/VBA7/x64 appeared to be much slower than under Excel 2002/VBA6/x32. Since I ...
user avatar
  • 375
1 vote
1 answer
77 views

Web Scraping DOL with Selenium

This is my code to extract data from the DOL website for a project I'm doing for my portfolio. The code does extract all of the data that I need, however it runs really slowly. I think it took like 15 ...
user avatar
  • 55
1 vote
0 answers
55 views

Solving a linear system with Gaussian Elimination

I decided to implement a solver for linear systems of equations based on the gaussian elimination and reduction to upper triangular form. The gaussian elimination is quite simple to implement but the ...
user avatar
  • 27.2k
2 votes
1 answer
93 views

Finding better logic for addition and removal of Nodes in a Linked List

Consider the following piece of code I wrote (a templated Linked List): ...
user avatar
4 votes
2 answers
1k views

VLOOKUP Macro to reformat data between sheets preserving the connection to the source

Hello I'm relatively new to VBA and I have this macro to VLookup information into corresponding cells in the sheet that works, the issue is that it depends on a For Loop to iterate through 10s of ...
user avatar
  • 57
0 votes
0 answers
55 views

Why is this MongoDB query so slow in comparison to python + in general?

There are 1.3M documents in my collection (5.0 and hosted directly on mongodb.com) and there is an index on "topic" and a combined index on "topic" and another field. However the ...
user avatar
  • 165

1
3 4
5
6 7
171