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
0
votes
0answers
9 views

Genetic algorithm for 8 Queens puzzle

I've finally got a working genetic algorithm to solve the "8 Queens" puzzle, however I'm aiming to get the run time of this program down to under 30 seconds consistently, and I really don't ...
0
votes
0answers
4 views

Count the frequency of n-grams in a random Wikipedia corpus

This code counts the frequency of n-grams in a random Wikipedia corpus, as of now, it downloads everything, than performs all the counting. In your opinion is there a way to perform downloading and ...
2
votes
0answers
27 views

Python: Random forest code optimization

I've been working on random forest algorithm for classification with roulette selection to find best splits. I came up with this homebrew based on this article https://machinelearningmastery.com/...
1
vote
0answers
46 views

MIPS-32 assembly: Determine if n is prime

I'm new to assembly and I'm learning on my own, so I'd appreciate the feedback. My priorities are correctness (on all MIPS-32 with sllv) > speed > readability ...
2
votes
1answer
47 views

How do you efficiently calculate YTD values in a pandas dataframe?

I implemented the following code to calculate the YTD sum in Pandas: ...
2
votes
1answer
46 views

My code creates a soundboard that can assign a sound to a key on a keyboard while listening to keyboard strokes in parallel

My code works but I am looking for an efficient way to implement the idea with out having to repeat the same code block inside the function Recin() (record Input function is stated in the code) in ...
6
votes
5answers
1k views

TString - An implementation of std::string

I wanted to make a feature rich string in C++. Similar to one in python. I am using C++14. I have not added much yet, I just want to get my code reviewed to ensure I am going the right way. Features: ...
7
votes
2answers
475 views

Hangman game in Python with nine possible words

I'm relatively new to Python, and I've been using the language for about a month. I set out to do the Hangman game. I would like to know if there are things to improve in the code of the program I ...
8
votes
3answers
344 views

Implementing a efficient Infix to Postfix using Shunting-yard algorithm

I was trying to implement an efficient (in terms of size of code (such as using one liners) and time and memory-efficient) of Infix to Postfix in python without the use of any external modules i.e ...
1
vote
2answers
109 views

Function wrapper that prints the result

(English) I was recently challenged to make a simple program that does the following: Function f accepts as a parameter a function g, which returns a value. Function f must return a function h which ...
1
vote
1answer
54 views

Hough Circular Transform

I'm writing a very basic crater-detection code using Hough Circular Transforms. By far, the longest part of my code is actually doing the transform, which involves numerous nested loops/conditions. ...
1
vote
0answers
21 views

Non-allocating k-nearest-neighbours between two matrices in Julia

I played around with some optimizations when answering this SO question. Sought is a function which given matrices x of size (m, l) and ...
2
votes
0answers
50 views

express.js server to resize images

What I have is a simple express js server where user sends an image url with a specific width all in the URL query. the code will get the image stream pipe it into a sharp.js module then send it back. ...
2
votes
3answers
99 views

567: Permutation in String

So I've been working on this for a few days actually. I implemented a solution to the LeetCode problem: 567. Permutation in String The Problem Given two strings s1(queryStr) and s2(sourceStr), return ...
1
vote
1answer
64 views

In place QuickSort algorithm in Python

I have been searching for ways to make my algorithm more efficient but most answers told me to divide the array into two differente arrays one of less elements and one of greater elements and then ...
3
votes
0answers
15 views

Extract text from scanned documents (JPG), output pdf version, classify documents based on text contents and rename pdf accordingly, then output csv

I would like to get some feedback on the below python code. It works correctly when run, but I am concerned about efficiency as it's not the fastest to run and also about whether I should be using a ...
1
vote
1answer
53 views

Saving and/or Printing a Word Document From C#

This is the Microsoft Word portion of the application described in this question. It is considerably simpler than the excel portion of the project. Any classes not defined in this question can be ...
3
votes
2answers
84 views

C# Tool to Generate MS Word Document Mailbox List From MS Excel

There is now a Follow up question to this question. Abstract The VBA solution didn't work on the clients computer because Office 2010 Starter Edition doesn't support VBA. I decided to try a C# ...
1
vote
0answers
21 views

ReactJS low re-rendering performance of the component

First of all, for explaining the issue better and avoid pushing long code here, I'll post the links of the files from repository. I have a feature simulation of the game that I am making a tools/wiki ...
2
votes
1answer
37 views

Python: Create submatrices from long/narrow table and save in HDF5

Hello dear StackExchange Community, I have written a small program which is doing the following. In short: it reads in a table in narrow format creates submatrices from it saves it in HDF5 format ...
1
vote
0answers
38 views

Lock-Free Single Reader/Single Writer Lamport Queue

I've created a lock-free lamport queue in rust. My code should be clear enough that you won't need to understand a lamport queue before reading it, but if you'd like a reference, this paper give a ...
-1
votes
1answer
73 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 (...
5
votes
1answer
95 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 ...
-1
votes
2answers
54 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 ...
4
votes
1answer
102 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 ...
0
votes
0answers
62 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 ...
0
votes
1answer
57 views

2 ConvertToBase3 methods with great disparity of execution time

I have two methods to do the same thing: convert a number to ternary. ...
3
votes
2answers
415 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 ...
1
vote
2answers
97 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 ...
1
vote
1answer
98 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? ...
5
votes
1answer
58 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 ...
0
votes
2answers
94 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 <...
1
vote
2answers
151 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 ...
2
votes
1answer
69 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 ...
1
vote
2answers
58 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? ...
0
votes
1answer
26 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 ...
3
votes
1answer
89 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: ...
5
votes
1answer
57 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'...
1
vote
2answers
73 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: ...
0
votes
0answers
36 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 ...
-3
votes
1answer
55 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? ...
4
votes
1answer
467 views

Reading from large binary files

I am reading data out of some large (~2GB each) binary files; these have a well defined structure: ...
1
vote
1answer
99 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 ...
1
vote
0answers
78 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 ...
-1
votes
2answers
91 views

Optimization suggestions for my Stack [closed]

stack.hpp ...
0
votes
0answers
67 views

SkiaSharp.SKCanvas – Can I draw this faster or at least with less CPU effort?

I built a VB.NET WinForms application. I integrated ‘SkiaSharp’ into my program because Visual Basic's own graphics class is slower in terms of performance. Nevertheless, I have slight performance ...
2
votes
0answers
30 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 ...
3
votes
1answer
73 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 ...
3
votes
0answers
145 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. ...
0
votes
0answers
33 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. ...

1
2 3 4 5
168