Tagged Questions
Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
3
votes
2answers
79 views
Basic Calculator - Takes 2 numbers and does an operation with them
I was wondering if anyone has any suggestions to improve my code. The code works perfectly fine for me (compiled it in BlueJ and Eclipse) but I was wondering what other more experienced programmers ...
3
votes
1answer
39 views
A Game Of Simon
This is one of the projects from freeCodeCamp. It's a game of Simon (a memory game). I would like a review on my code.
...
2
votes
0answers
33 views
Parse long string in Go
I'm sure that my server can work with better performance, but it's just a dream.
Parsing a very long strings is not so obvious task for me.
I have a server that handles a lot of clients requests and ...
-1
votes
0answers
4 views
Querying database in Rails using includes and where for has many through relationship [on hold]
I would like to get all of the Coaches that have an Expertise level above 0 in Sports.
Coach has many Sports through Expertise
...
0
votes
0answers
27 views
Javascript Parallax Scrolling Text
I built a 404 page which involves parallax scrolling text. The program updates the position of 100-200 text nodes at each animation frame called with ...
1
vote
1answer
43 views
SICP exercise 1.28 - miller-rabin test
From SICP
Exercise 1.28: One variant of the Fermat test that cannot be fooled is
called the Miller-Rabin test (Miller 1976; Rabin 1980). This
starts from an alternate form of Fermat’s Little ...
2
votes
0answers
59 views
Find minimum distance in matrix
Challenge URL:
http://acm.scu.edu.cn/soj/problem.action?id=3330
Windy has a matrix A with size N*M which only contains 0 or 1. The
distance between Axy and Apq is: |x-p| + |y-q| Can you help ...
0
votes
0answers
61 views
New to Haskell | Help me write good code [duplicate]
So I recently started picking up the Haskell programming language. I've managed to learn other language rather quickly, but I'm still having a difficult time grasping some of the basics of Haskell.
I ...
1
vote
1answer
54 views
Fast nth prime in Python using trial division
I'm trying to speed this code up for larger values of N. Any suggestions?
I'd like to stick to this implementation and not move on to something more complex like numpy or sieves.
Is there any low ...
3
votes
2answers
52 views
Time conversion program optimization
I have just finished working on a problem on hackerrank dealing with time conversion in C++.
I'm still fairly new to programming as I only have a few semesters of programming classes under my belt ...
2
votes
3answers
452 views
4
votes
0answers
64 views
UWP scan for music files
I am implementing a music player for Windows 10, and I am in a bit of a pickle at the library phase.
I am scanning for all the files in a music library (plus optional folders the user selects) and I ...
1
vote
0answers
66 views
Unwrapping multiple inner loops in CUDA for 4D nonlocal filter
I'm working on some sort of non-local means filtering in 4D space (x,y,z + time). The idea is to pass to GPU a chunk of large 4D array in order to process it and return a filtered 3D slice (then ...
0
votes
1answer
44 views
Tic Tac Toe Algorithm revisited
I had previously submitted a tic tac toe code. I followed some of the changes suggested. This is my new code.
...
1
vote
1answer
34 views
Sort by year and day descending, yet time ascending
I recently discovered a hugely inefficient portion of code in my program, and have gone about rewriting it. I am however, not quite sure if the rewritten program actually does exactly what I want, due ...
3
votes
1answer
88 views
Concurrent non-blocking update of cached list of on-line users
I have following problem: My server (ASP.MVC WebAPI) is tracking, when client application ("Agent") is on-line. It's storing this inf on following table:
...
-1
votes
0answers
20 views
My Website Script loading takes a long time [closed]
StackExchange Code Review community. I'm currently building a Forum out of Pure AngularJS. What I'm asking is why is my website loading so slow for some reason. I'm Guessing there are multiple ...
-3
votes
0answers
15 views
How can I change my code using SIMD/AVX to calculate ranks in my page rank algorithm? [closed]
I am writing a page rank program. I am writing a method for updating the rankings. I have successful got it working with nested for loops and also a threaded version. However I would like to instead ...
3
votes
2answers
34 views
Bash script to perform LUHN check
The following Bash script takes a single parameter (the PAN) and exits with 1 if the PAN does not satisfy a LUHN check.
...
9
votes
3answers
845 views
Calculating the amount of cubes needed to form a sum
Since I've never done any performance programming (Aside from the better choices such as array vs list etc. The real basics.), I should probably read up on it. But I had to start somewhere, so, ...
0
votes
0answers
20 views
Finding largest sum of submatrix
I found a way to output the biggest sum of square submatrix, but it should work faster. Can someone suggest a better way?
...
2
votes
1answer
20 views
Random walker using Processing.JS on Khan Academy, with new walkers generated on mouse click
I've created a project on Khan Academy as part of the Natural Simulations course on random walks.
This project is in JavaScript, using the Processing.JS library, slightly modified by Khan Academy.
...
1
vote
1answer
30 views
Object key diff
I've been tasked with finding property differences in massive JSON structures and return them in a particular fashion ([key_1.key_2, key_1, etc]).
Here's my code, which is focused on readability so ...
1
vote
0answers
36 views
-1
votes
0answers
21 views
Optimization of matlab code
I am relatively new in MATLAB and my major problem is optimization. My code seems to run very slow and I can't think of any way to make it faster. All my arrays have been preallocated. S is a large ...
0
votes
0answers
36 views
Codility Fish Test 50%? [closed]
I am getting a 50% overall mark (75% correctness and 25% performance) on the Codility Fish problem and my solution seems to be O(N) but I am only getting 25% performance. The results can be seen here ...
4
votes
1answer
121 views
Maximum profit from buy and sell offers
Given a list of sell offers and a list of buy offers for an item I want to determine how many units to trade for maximum profit.
Each offer consists of a price and a maximum amount of units being ...
2
votes
1answer
67 views
Algorithm for Tic Tac Toe
Currently, I am using an algorithm that finds the best move based on the existing states of the board. Is there a better way to do it? Is there a data structure that I can use?
I have also considered ...
1
vote
1answer
31 views
Parallax animation running well on Chrome but slow on Safari
This is the continuation of a previous question I posted here.
I've improved (at least I think so) the initial script from the previous question, now storing the data in an array, it runs slightly ...
0
votes
0answers
23 views
6
votes
4answers
799 views
Detecting if two strings are anagrams using TreeMap
I decided to use Java TreeMap because it seems like a great data structure to fit this problem. However, I am not sure if there could be much simpler methods using ...
7
votes
1answer
51 views
Interpolating data of multiple trains
I have written a piece of VBA code to essentially replace a complex formula that I was using in the Excel cells.
I have the data on Sheet2, which describes multiple train journey's along the same ...
7
votes
2answers
47 views
Higher performance reading shorts from binary file
I just got rejected at the tech interview of a job application. They gave me the following exercise for me to complete:
They gave me a binary file with 10 million pairs of 16-bit signed integers. ...
2
votes
2answers
46 views
Show and Hide group of classes based on data attributes
Somebody please verify this code. Is this efficient? please tell me modular way to accomplish this task.
Updated
I want to add show class to ...
2
votes
1answer
111 views
Creating archive from over 3GB of files in less than 1 minute
This is a follow up to this question. I got some very good answers for my process speed, and wanted to go ahead and share what I've done with the program. The new updates of the program consist of the ...
4
votes
2answers
80 views
Copy, Paste and Format 2.0
This is a follow up with revised code, see the original question and subsequent answer in the following link (Copy, Paste And Format)
This is a full version of all three "Macros" or subs within the ...
10
votes
1answer
543 views
Copy, Paste And Format
I am currently working with this code to automate some tasks for senior staff members that are not very adept in Excel. Wondering if VBA is simply not a very quick code or if my code is clunky and ...
5
votes
1answer
80 views
Parallax animation, running well on Chrome but slow on Safari
I have the following script to create a parallax effect on the page using request animation frame, it runs well on Chrome, but on Safari is lagging, I think because I run too many calculations on each ...
1
vote
0answers
25 views
Estimate Hidden Markov Model with both continuous and discrete observations, possible missing data
My code estimates a Hidden Markov Model (HMM) using the expectations-maximization (EM) algorithm. I followed https://www.princeton.edu/~rvan/orf557/hmm080728.pdf with modifications to allow for panel ...
0
votes
0answers
24 views
Php Ajax script to check server status of sites from db
I am writing a script for a client so hey can check the status of their servers.
The script performs ajax requests to get the data as json then poulates the table with the returned json results.
is ...
4
votes
0answers
42 views
Matrix of heights test
I was writing a program for my math class because my Professor asked me to. The problem is as follows: 300 people are arranged in 30 rows each of 10 people. The tallest of each row is chosen, and the ...
2
votes
1answer
55 views
Beating a dead horse: Project Euler 4
The task
A palindromic number reads the same both ways. The largest palindrome
made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the ...
5
votes
1answer
73 views
Speeding up process time while archiving files
I asked this question on Stackoverflow, and was told I might have better luck here.
I'm new to c# and have created a basic file archiver. It works, and it does what it's suppose to do, but I think ...
11
votes
2answers
192 views
Python 3 decompression routine 10x slower than C# equivalent
I'm relatively new to Python 3, especially IO programming, writing a Blender add-on to import model data.
The model data is available in a custom compression, and I originally wrote code in C# to ...
-1
votes
2answers
76 views
Code efficiency - Piglatin
My code works and does what it is supposed to. However it needs to be more efficient. Could anyone help me tidy this up and show me where I could perhaps not rely on large loops (which it does a lot ...
2
votes
1answer
45 views
Raindrops in Java
Problem Statement:
Write a program that converts a number to a string, the contents of
which depends on the number's prime factors.
If the number contains 3 as a prime factor, output ...
5
votes
2answers
131 views
+100
Find group of available stalls in an aisle
An aisle is defined as two rows of six stalls each. A stall is adjacent to another if it is directly next to it or across from it. My method finds out how many stalls can be found in a chain from ...
7
votes
2answers
259 views
Card-fighting game Part 2
Information:
This is part 2 of the game I am building. After some good feedback on my first post I decided it was time to post my updated code. The differences in this part are: Updated code after ...
5
votes
2answers
78 views
Movement around a large map
I'm trying to make a small shooter game, where you can only see a small portion of the map around you. The map will also be much larger then the actual JPanel (The panel is 1000 by 1000, the map ...
2
votes
1answer
65 views
Graphic Ape Designs gallery website
I am currently working on my YR9 (I'm 14) IST web development project and I want to know some tricks for optimizing my website.
I know that I shouldn't have the same CSS rules in the style tag on ...