Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

learn more… | top users | synonyms (4)

2
votes
0answers
17 views

Clojure reverse multiple times

I have a piece of Clojure code that reverses a string recursively. It is working but too slow (because I got the problem from Codewars and I cannot validate it ...
0
votes
0answers
13 views

External / File-based mergesort (what is MAPPEDSHIFT, MAPPEDMASK, MAPPEDSIZE?) [on hold]

I am currently working on a file-based merge-sort implementation and found the topic "External / File-based mergesort" in this forum. Link: External / File-based mergesort I tried to run the code ...
2
votes
0answers
36 views

Find all distinct subsets that sum to a given number

The function wants to achieve to find all distinct subsets that sum up to an given number. ...
1
vote
1answer
24 views

Quickly find percentile with high precision

I need to find the percentile where a list of values is higher than a threshold. I am doing this in the context of optimization, so it important that the answer is precise. I am also trying to ...
1
vote
0answers
35 views

lock-free list performance

I tried to write a lock-free list in c++ unfortunately the performance compared to a std::list secured with a simple mutex is bad what do you think? Are there major performance or code-style issues? ...
2
votes
2answers
184 views

Edit method, optimizing and minimizing method to reduce complexity

Yesterday I had posted a question regarding optimizing editMethod here on code-review. Thanks to an awesome answer by Pimgd, I was able to merge conditional checks, checking conditions and few other ...
5
votes
1answer
40 views

Dice roll program with statistics

This is a working program I made to roll dice a specified number of times, show how many times each number (2-12) occurred, and the percentage of the total rolls that each number got. I'm trying to ...
6
votes
3answers
58 views

Circular Buffer

For my current project I need a circular buffer, which is able to do the following things: Push something to it (to the head). Pop something from it (from the tail). I don't need the popped data. ...
4
votes
2answers
273 views

Getting all possible letter combinations of a word

I wrote a simple algorithm for finding all possible letter combinations of a single word. I want to know if my code can be improved in any way, although I'm mostly interested in efficiency. You can ...
5
votes
1answer
106 views

Edit method, doing multiple checks for tracking changes vs the one in database

I am working on a Spring-MVC application in which there are around 2-3 methods which are quite big and complex, but only one of them worries me, especially for maintenance or changes. As changes in ...
1
vote
0answers
52 views

Calculating all possible Knight turns (Chess)

I'm creating a console application that takes as input starting column and starting row, also the ending column and the ending row and it's going to output all the possible way's to get to that point ...
3
votes
3answers
91 views

An assignment algorithm in C

As a post processing step of a similarity matrix computation that leads to the non-negative matrix mt4_ in gpu, I am performing an assignment step to determine ...
4
votes
3answers
214 views

Deleting rows based on a date

I am deleting rows based on a date. I am loading the entire sheet into an array and doing the evaluation and building a string containing the rows I want to delete. ...
4
votes
1answer
42 views

Java NIO server Selector loop

I have a server that uses Java NIO in non-blocking mode. Right now I'm using a single thread for the selector, and four worker threads to process the bytes after ...
5
votes
1answer
52 views

SlidingNumberTile Program Efficiency

I created a Sliding Number Tile Game, and am looking for input on how to make the code better organized & more efficient. ...
4
votes
2answers
112 views
+50

Multiprocess, multithreaded read write on a single file

I've got a job to create a library that would be able to support multithreaded and multi process read and write to a single file. On that single file we would store C# models in an array in JSON ...
1
vote
0answers
43 views

Priority message sending

We have created a message queue system using priority messages. The idea behind this code is as follows: We have a list of clients. All clients know if (and what kind of priority) messages they have ...
2
votes
0answers
76 views

Number-to-words translator

I've created a class that translates an integer into words in an English (not British) format. My first human language is not English, and I don't have a good idea of a truly right way to read ...
2
votes
1answer
33 views

Nested loops - Random Forest, multiple parameters

I'm writing a code which task is to grow Random Forest trees based on multiple parameters. In short: Firstly, I declare a data frame in which model parameters and some stats will be saved. Secondly, ...
2
votes
1answer
45 views
0
votes
0answers
33 views

Distinct List of attribute values from XML, using a pre-defined set of attribute names

I have an XML stream that looks like the following (attribute and node quantity , and node depth reduced for demonstration purposes.) ...
3
votes
2answers
80 views

Reading file into structure

At the time I'm trying to read a quite big file into a C program for later user. The file size is in the range of 800 megabytes containing around 20 million lines of data of the following format: ...
3
votes
1answer
28 views

Putting a matrix from a text file into a list

I'm trying to read a text file with matrix and put it in a list, but I am using two loops here and I want my function to be faster. ...
0
votes
0answers
9 views

Improving the performance of web scraper using BeautifulSoup

I am using python3 with Beautiful Soup to scrape web site, I also used Thread to download images, but it will spend more than 30 minutes to get all information and download relevant images, how can I ...
3
votes
1answer
48 views

Josephus permutation - follow up

Follow up of this question Changes: The pop_min function now panics if the tree is empty. Moved the size attribute to the ...
10
votes
4answers
114 views

n-queens puzzle in Python

I want to increase the efficiency and reduce the time complexity for the n-queen problem in n*n matrix chess. I am able to run only still (11*11) in normal time otherwise for the big number it is ...
4
votes
1answer
116 views

Finding the longest path, avoiding obstacles in a 2D plane

The Scenario You are given a matrix of size m x n (width x height) with m*n spots where there are a few obstacles. Spots with obstacles are marked as 1, and those without are marked as 0. You can ...
4
votes
1answer
73 views

Josephus permutation

This problem is taken from the book Introduction to Algorithms, Third Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein: We define the Josephus problem as ...
4
votes
0answers
42 views

Shortest path navigation across a grid using Best First Search

The code below is an implementation of the Best First Search algorithm for navigation of the shortest path across a 2D NxN matrix. As a heuristic for the search I use the standard distance formula. ...
3
votes
1answer
49 views

Portably generate uniformly random floats from mt19937 output

My goal is to generate a sequence of random float from a seeded random generator. The sequence should be the same on any machine / any compiler -- this rules out ...
3
votes
5answers
120 views

Python palindrome checker

This is my palindrome-checker It is doing what it should do ...
-4
votes
0answers
38 views

Loading a huge number of images in the View [closed]

I have to just load huge number(1 million) of images in a view. My app is fetching the images from api call using background jobs but my app is getting very slower when I load the view it is taking ...
5
votes
0answers
40 views

Copy files mentioned in an Excel sheet

Please help me in reducing the time complexity of this code as it is taking a long time to read its Excel input. ...
2
votes
1answer
61 views

Printing longest sequence of zeroes

I am doing a coding exercise in codility and I came across this question: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ...
2
votes
2answers
95 views

Functions to merge dictionaries with a comparison

I have several functions for merging some dictionaries but over time I created a more general function that would make all these others obsolete if it weren't slower. I have the specialized (and ...
0
votes
0answers
33 views

Permuted index generator (second version)

I have implemented a second program that produces a permuted index; here is my first solution. As advised in one of the answers, I split my program into two classes. Could anyone tell me if I did ...
3
votes
3answers
341 views

Optimizing timeline generation

I have a bunch of processes that are being executed on different virtual machines. All of those processes have a StartDate, ...
5
votes
3answers
149 views

Duplicate-preserving collection intersection

Python sets are magical things. Mutable, deduplicating data stores with handy operator overloads for &, ...
6
votes
2answers
84 views

Recursive directory copy program

A little while ago, I had to write a little C# application to recover my HDD data (full context on this question) To answer my problem I developed a console application which job was to recursively ...
4
votes
3answers
199 views

Using Enum to Handle String literals

I have a java component that was using a lot of string literals that I need to make comparisons on and return booleans based on these comparisons. In order to make the code more robust I externalized ...
2
votes
1answer
54 views

196-Algorithm Program

Attempting to see whether using 196 as a respectively in my program will have a result or not, I made a simple function to test it. Now the 196-Algorithm requires ...
1
vote
0answers
35 views

Progressively split and map a large, line-based string

Goal I have a large string (~10MB in ~400k lines). I want to "efficiently" split it on a delimiter and map the resulting sets of lines. Efficiently is defined as something that is fast (wall time), ...
0
votes
0answers
24 views

Checking if a 3D point is outside of a trapezoid

I have recently written if a 3D point is within a specified trapezoid. It does it by checking 3 different planes of the trapezoid. I place the relevant 2 coordinates from the 3D point into the current ...
6
votes
3answers
318 views

Rotation of elements in an array

We had to write a program that would perform rotation of elements in an array. The array size was entered by user, so it had to be in a sense, dynamic. Rotation or Circular Shifting Initial Array: ...
2
votes
1answer
27 views

Optimize performance of flatten function in python

I have to flatten a large number (>300k) dicts to write them to a csv file. Example: ...
2
votes
2answers
44 views

Java web scraping robots

I am developing application that goes through 2 websites and gets all the articles, but my code is identical in most parts, is there a way to optimize this code actually :/ (TL and DN are the naming ...
4
votes
2answers
114 views

Counting primes less than n

The following code was written to be a submission to this challenge on PPCG. It uses this algorithm, the Meissal-Lehmer method. I follow the Wikipedia entry pretty naively, except I tried to memoize ...
3
votes
1answer
42 views

SICP - exercise 1.11 - tree recursion

From SICP Exercise 1.11: A function \$f\$ is defined by the rule that: \$f(n) = n\$ if \$n < 3\$, and \$f(n) = f(n-1)+2f(n-2)+3f(n-3)\$ if \$n >= 3\$. Write a procedure ...
15
votes
4answers
581 views

Generating formatted multiplication tables in C++

I am self studying C++ from Robert Lafore's OOP in C++. I am solving the first exercise questions of chapter-3 loop and decisions. I've written three different codes using different approaches. I want ...
4
votes
3answers
70 views

Extracting sleep quality scores from periodic readings

How can I optimize the next function to work faster? The function must prepare a list to put in a CSV file. The list must contain values of average percentage of sleep per minute counted from ...