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 (2)

3
votes
1answer
25 views

Expandable, object-oriented tic tac toe module

Just for practice, I am writing a tic tac toe game in Python 3.4. My main goal is to make expandable, for example allowing larger boards and more than two players. The way my project is arranged ...
2
votes
1answer
20 views

Fast canonical indexing of elements in array

Given two arrays of elements: aaabbccdefaa zzzccddafgzz I want to check whether these two arrays are equivalent up to a relabeling. My strategy is to map them into a canonical form and ...
2
votes
1answer
41 views

Fixed size double-ended queue

I require hundreds of equal, small sized buffers in my current project. The bulk of the computation in the program operates on data stored directly in those containers, so high performance is ...
3
votes
2answers
248 views

Checking the difference between old and new XML

I have two xml files, about 500mb each, an old and a new. I want to find out what items have been added or removed in the new.xml compared with the old.xml. I had some help on this code and I'm a bit ...
2
votes
1answer
48 views

ASCII game Java applet

This code is probably really badly written and terrible... but it works. I need some constructive feedback, and some tips on optimizing it as it kinda flickers whenever I move the x with the arrow ...
0
votes
0answers
19 views

LINQ to Entities query of tests for my classes, with many subqueries

This MVC4 controller method, which uses EF6, is taking a long time to run (over 2 seconds). I've added verbose comments for the purpose of this post only. ...
3
votes
1answer
55 views

Exotic bitmap renderer for core drawing functions

I am very interested in inventing the best way possible for rendering bitmaps on-screen using the base drawing functions (putpixel(x, y), ...
2
votes
1answer
43 views

Loop through folder names on a server directory

I have the following code to loop through a directory of folders and print all folders names with their paths in a worksheet. This is a follow up question to this one: Excel VBA - Get Folder Names ...
3
votes
0answers
42 views

Chebyshev polynomial evaluation class using C++1z fold expressions

I've been messing around with templates in c++14 and c++1z recently, and since I have somewhat of an obsession with optimization ...
8
votes
2answers
94 views

D&D dice rolling app

This JavaScript object is part of a mobile application that rolls dice for our D&D games. Here are some example of possible inputs from the user: 2d4 2d4 + 3d6 2d4 + 3d6 + 12 ...
1
vote
0answers
40 views

Compute weighted average around a point in a matrix quickly

I have a short snippet of code that simply computes a weighted average for surrounding elements in a square matrix. The actual implementation that I'm working on is not an average (more complex ...
-1
votes
1answer
24 views

Optimizing jQuery/JS Switch Statement

I am trying to optimize the following switch statement, but I'm having a brain fart about how to do it. Here's the code: ...
1
vote
0answers
15 views

Bookmaker odds and offers query

The following query returns the latest Odds for each Offer based on the timestamp on the ...
2
votes
1answer
25 views

Scheduling real world events for Arduino project

I am working on a project that involves scheduling real world events for a pool. Example: turn a pump on at 8AM, turn heater on at 9 AM, set heating temperature to 80 degrees, turn the pump off at 10 ...
6
votes
3answers
103 views

SPOJ Adding Reversed Numbers

Recently, I was taking up this challenge and choose my favorite language 'Ruby' to do it. My following solution got accepted (Gist). For each test case, I am to reverse two numbers, add them, and ...
1
vote
2answers
48 views

Function to rotate bitmap image

Presenting you an implementation of the "shear and transpose" method of rotating a bitmap image. It works.. but it works slow, which is fully understandable. It is understandable due to the evident ...
4
votes
7answers
101 views

Printing a multiplication table

I was recently given a coding test by an employer. After the test, this was the employer's response: "I’d say that a lot of his solutions were pretty inefficient and took a very ‘brute force’ ...
6
votes
1answer
156 views

Line segment to circle collision algorithm

I've written a function (in Python 3) which computes if a line segment (constraint) and a circle (body) collide, and returns the point of intersection (closest point to the centre of the circle): ...
0
votes
0answers
16 views

D3 csv data loading and display with dc.js

This is part of a JavaScript web application I made as a personal project to browse a 10k movie database. (available here) The application is loading a big CSV file (5Mb) and then making some plots ...
10
votes
4answers
631 views

Imaging with getPixel() and loops

I wrote perfectly working code that reads an image, and then does a kind of threshold on it by zone. If the zone has too much white then it turns all the zone into white, otherwise it turns into ...
6
votes
0answers
59 views

Gray codes addition — Take 2

For a while, I have tried to find ways (known or new) to do stuff with Gray codes. As some of you probably know, I already tried to implement an algorithm to add two Gray codes without having to ...
0
votes
2answers
77 views

Changing algorithm to avoid looping with iterrows

I am new to Python. I wrote a code that works but the algorithm is obviously not efficient at all. I am stuck in the loop on iterrows and I do not see how to get rid of it. First a little bit on the ...
1
vote
1answer
40 views

Counting only weekend days between two timestamps

I am fairly new to the Groovy arena. I recently modified some code to add the following block. This code is added to remove dates we were supposed to remove from the total counts. This data goes on ...
2
votes
2answers
50 views

Users and friends query with retry, returning JSON

I am new to Azure and SQL. I have the following function that is part of a larger Web-API which is hosted on Azure and is querying an SQL Server database that is also hosted on the Azure platform: ...
-1
votes
2answers
69 views

Parsing a big text file, extract data & store it in a CSV file

I have a big log file (say 1-3 Gb) which I need to parse, extract data & save it in a CSV file. Text File Data ...
4
votes
2answers
93 views

Extracting and analyzing data from SAP

I developed a script for the company I work for in order to extract data from SAP (CJ74) and analyze the data. One particular issue I am finding is that for any data sets which have over 1000 lines, ...
3
votes
1answer
55 views

NumPy array filter optimisation

I've got a filter that I'd like to work out how to optimise. The most basic implementation, using loops is like the following: ...
1
vote
1answer
58 views

FPS efficiency for 'attack counter'

I have a code snippet which I wish to improve to increase my program's FPS, but as a beginner in JavaScript, I do not know how. I know the problem, which is the fact my counter mechanism used to delay ...
3
votes
3answers
84 views

Calculating highs, lows, and volumes of stocks

I'm trying to review and figure the issues in the above code. Any inputs to point out problems are welcome. ...
4
votes
3answers
862 views

Project Euler -problem 1

Find the sum of all the multiples of 3 or 5 below 1000. https://projecteuler.net/problem=1 Is there any hack to do modulo operation in better way? ...
3
votes
4answers
227 views

Splitting an array at commas

I was given a file of size 46KB full of names (around ~5000), in the format as shown below: "MARY","PATRICIA","LINDA","BARBARA","ELIZABETH"..."DARRELL","ALONSO" ...
2
votes
2answers
42 views

Listing all paths through a matrix, stepping right or down only

I have the following method, which finds all the possible paths from the top left to bottom right of an N x M matrix. I was wondering what is the best way to optimize it for speed as it is a little ...
5
votes
0answers
46 views

Statistics about gaps in DNA sequences

Noobie to Numba here, I'm trying to get faster code from existing function but the result is not faster. 10 times faster would be heaven, but I know nothing about optimization. This is code about ...
2
votes
2answers
44 views

Rhythmic task controller

The purpose of a rhythmic task controller is to accept a task and execute all the queued tasks in a cycle or "rhythm" defined by the client code. A task returns true or false depending on whether or ...
5
votes
5answers
173 views

Performance of object-to-string conversion

Using an OR/M I map a lot of rows from database to array of objects (~300k). In these objects some properties are marked with special attribute [Signed]. Row-by-row ...
-1
votes
0answers
30 views

performance of nCr%m? [closed]

I'm trying to find nCr%m. I have tried Euler's Modular Inverse method but It also happens to be slow. then I came across this implementation of Lucas Theorem: ...
5
votes
2answers
47 views

Bitmap-based Sieve of Erastothenes

I have written a simple implementation of Sieve of Erasthotenes (in C, MSVC flavour), which I believe is correct (source below). Is there a way to make it faster and more readable? ...
3
votes
1answer
85 views

Calculating harmonic sum

The problem is that I have executed the program for the last hour and it hasn't returned a value till now for input 1022. How can I make the program a bit faster? How can I increase the efficiency of ...
1
vote
0answers
23 views

Java program to encrypt files using Shamir Secret Sharing

Shamir's Secret Sharing scheme essentially splits a secret into n parts, at least k of which are needed to recover it. I'm using that to encrypt/decrypt arbitrary files (it's part of a college ...
6
votes
1answer
111 views

Code Inspection: Procedure not used

Here is yet another piece of Rubberduck code, this time the nasty ProcedureNotUsedInspection class, whose role is to identify all procedures that are never called ...
3
votes
1answer
43 views

Merging two lists of dicts based on the value of a specific key

I'm combining two lists of dicts, based on the value of the key 'time'. If have two lists, for example: ...
3
votes
1answer
40 views

Project Euler #10 in Ruby. Three ways to sum primes below 2 million

Question: Add all prime numbers smaller than 2,000,000. The first method is done by deriving own is_prime? method: ...
3
votes
2answers
93 views

Double-ended linked list

I want to know if there is any redundancy in the code or if it is missing something. I ran it with several different choices and it works fine but I still want to know are there any more subtle ...
2
votes
0answers
22 views

Route factory which creates instances based on database context and model

I am trying to bridge the gap between the database context and routes that are stored in the database. The factory is designed so that when used in other assemblies, you are forced to use the ...
2
votes
1answer
44 views

Common operations on a linked list (user defined)

I have just started learning data structures and for the past two days I was going through linked lists. I have implemented the basic/common operations on the linked lists and I would love for some ...
1
vote
1answer
49 views

Suffix Array Construction

I'm trying to implement a suffix array for use in programming competitions. I'm using the CodeForces example and trying to "make it my own" so I can make sure I understand it and feel better about ...
0
votes
0answers
13 views

Groovy method optimization to build <String, List<List>> tokens

I have a string array: ...
4
votes
0answers
51 views

Persistent segment tree

I'm trying to solve this problem. Given a sequence \$B=B_0,B_1,\ldots,B_{N−1}\$ for each query \$(P,K)\$, find the minimum \$S\$ s.t. there are at least \$K\$ entries in \$B\$ that satisfies ...
0
votes
0answers
35 views

Simple login system in prolog

The code produces a dialog that allows a user to enter information, then verifies the information and allows the user to have access. Is there any way to improve the code? ...
1
vote
1answer
38 views

Slow data processing problem (looping over an array with context to prior elements)

I have a binary file with alternating uint8 and uint64 data stamps. I read those in by using the following line: ...