Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
2
votes
0answers
12 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 ...
3
votes
1answer
38 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.
...
2
votes
1answer
36 views
c# Multi process, multi thread read write on a single file
I've got a job to create a library that would be able to support multi threaded 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
33 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 ...
1
vote
0answers
66 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 ...
1
vote
0answers
22 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
35 views
0
votes
0answers
28 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
78 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
27 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
8 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
0answers
32 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 ...
9
votes
1answer
62 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 ...
3
votes
1answer
111 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
62 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
37 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. ...
-9
votes
0answers
32 views
What are the Possible Flaws in my Program and Suggestion For Optimization [closed]
Here is my code, It's Java Script,
...
3
votes
1answer
45 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
116 views
-4
votes
0answers
36 views
Loading a huge number of images in the View [on hold]
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
39 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
57 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
94 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
340 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
81 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
198 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 ...
-1
votes
1answer
24 views
Managing game entity data [closed]
I am making a 3D game and I'm focused on performance.
I'm making a entity class.
...
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
315 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
26 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
43 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
113 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
41 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
569 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
69 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 ...
5
votes
2answers
80 views
Document term matrix in Clojure
This is my very first foray into Clojure (I'm normally a Python-pushing data-type). I'm trying to create a simple term-document matrix as a vector of vectors, out of a vector of strings.
For those ...
4
votes
0answers
37 views
Median filter for large mask
I'm trying to implement the fast median filter developed by T.S.Huang (HUANG, T.S. 1981. Two-Dimensional Signal Processing II: Transforms
and Median Filters. Berlin: Springer-Verlag, pp. 209-211.).
...
1
vote
0answers
34 views
Update method using timer in WinForms Poker app
I have a WinForms Poker app that needs to update some stuff and im doing this by using a timer:
...
2
votes
1answer
76 views
Poker app in C#
I am developing a poker application using C#. It is almost done, and I'm looking for improvements. One of the things I wonder is whether I should change my method that checks if the player has a ...
3
votes
1answer
65 views
Python 4 Players Snake Game
I would really like to hear out some suggestions as well as general response to the code I've written for 4 players snake game. It's my first time using pygame module, as well as trying to design a ...
4
votes
2answers
52 views
1D shock tube problem written in Fortran
I have written a simple Euler solver for the 1D shock tube problem. Eventually, I plan to extend this code to solve the full 3D compressible Navier-Stokes equations. Therefore, I want to start with ...
6
votes
4answers
822 views
4
votes
2answers
42 views
Storing disassembled data in a structured way
I want to store the information returned by the dis function of the dis module in a structured way, using a dict, associating the mnemonics of each code of a line to the correspondent line number.
...
2
votes
2answers
80 views
My spaceship is slow to explode after being hit by the asteroid
I am making a game for my computer science class. My professor's requirements are:
Write a Processing program that draws a triangle in the middle of the window.
Rotate the triangle when the left and ...
3
votes
2answers
352 views
Web dashboard using many REST API requests
I have created REST API in codeigniter. REST sever created in codeigniter 3.0 and REST client created codeigniter 2.x.x.
I have wrote simple code for login. After login client created dashboard ...
1
vote
2answers
69 views
Concatenate three 16-bit integers in one 64-bit integer with C++
I am looking for an elegant alternative of the following code where wordXX contains always 16 bits:
...