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)

1
vote
0answers
12 views

Recursive Implementation of Merge Sort C++

I am currently reading an algorithms book and I read on the insertion and merge sorts. I implemented the merge sort in C++, The first function MERGE is responsible for the merging of the two subarrays ...
4
votes
1answer
40 views

Generate dictionary of points on n-sphere

This is a long-shot, but my question is to simply optimize this particular function in some code I have written: ...
1
vote
0answers
15 views

Forecasting function using auto.arima for 15 samples of data

I have a workbook with data sampled. i have multiple samples based on date range. one sample starts from january, where other can start from february and so on. I need to build forecasting function ...
2
votes
0answers
19 views

VBA - Cycles through a table to find the cheapest bearing that passes

I have written several VBA macros to run on an excel spreadsheet. Inputs are entered into a table and then the macro is run; it cycles through a table of Bearings (in price ascending order) and ...
3
votes
1answer
50 views

3Sum implementation

I have recently started to work through the problems on Leetcode, for the sake of bettering my own skills as well as preparing for interviews. I was faced with the 3Sum problem which is: Given an ...
2
votes
1answer
47 views

Sum of all paths between all pairs of nodes in a tree

I'm trying to solve a competitive programming problem. It basically gives a undirected graph (tree-like: no multiple paths between two nodes...) and asks for the sum of all possible paths between any ...
4
votes
4answers
50 views

Get a list of indexes for list A based on criteria in list B in Python

I have one list of data with duplicate IDs and a second list of data with attributes for the IDs. ...
5
votes
0answers
54 views

Atomic floating-point addition

I need to be able to atomically add a 32-bit floating point value to a location in memory. Here is what I came up with. While the code is Windows-specific, I'll extend it with Linux support using <...
2
votes
2answers
427 views

Poker hand probability — tally best 5 from all combination of 7

Related to Poker Hand Evaluator. This it not the same. This is take best from all combinations of 7. The other is all combinations of 5. Poker is 52 cards - 4 suits and 13 ranks: Texas holdem Hand ...
2
votes
1answer
32 views

building a search functionality

I am trying to search account table by providing a search string. I am building a query based in different conditions and then adding the returned records in a list. The functionality is working ...
2
votes
1answer
22 views

Hotkey detection for UI elements

I have several UI elements that can be opened using hotkeys for example the settings menu's key is Escape. The problem is that I have the Keycode stored in ...
10
votes
2answers
1k views

Taking arbitrary length input in C

Instead of having to use something like char buf[100500] and hope that no possible user input could be longer than 100500 bytes, I decided to make the following ...
4
votes
0answers
91 views
+100

Neural Network in Haskell

Following this website I wrote a neural network which uses the MNIST training data to recognize digits. The author writes that it should take a couple of minutes to train the network with 30 epochs of ...
1
vote
0answers
26 views

Single request weather app using ForecastIO service

I needed a web weather for a app that talks to ForecastIO API. Basically that sent a request to https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE giving me ...
4
votes
1answer
62 views

Extracting time duration in the session from 30 million rows

I am looking for making my code faster. I am working on yoochoose recsys 2015 dataset.. and trying to perform some transformations.. [recsys2015], it has got 30 million plus rows of data. The goal of ...
6
votes
3answers
99 views

Revised - Game of Fifteen

This is a revised version of a previous post. I attempted to address each aspect of the feedback provided. The key changes are as follows: Replace the deprecated ...
2
votes
1answer
64 views

Concatenating two substrings to provide the largest possible palindromic string

The code extracts two substrings from different strings and concatinating them to provide the largest possible palindromic string. Objective: You have two strings, (a) and (b). Find a string, (c),...
2
votes
1answer
32 views

Efficiently calculating differences between file using diff file

I'm using SVNKit to get diff information between two revisions. I'm using the diff utility to generate a diff file, however I still need to parse it into numbers. I implemented a solution, but it is ...
6
votes
1answer
51 views

Python matrix implementation

I created a simple matrix implementation and would like some critique of it, for example: Things I could add to make it more useful Ways I could make it more efficient (for example __pow__ or ref()) ...
3
votes
3answers
83 views

C++ Queue Implementation

so I wrote a queue implementation in c++ and even though I know the code probably isn't as robust as it should be and probably doesn't perform all the checks it should, I'd like to know mostly if ...
6
votes
3answers
357 views

Save the Prisoner

A jail has prisoners, and each prisoner has a unique id number, S, ranging from 1 to N. There are M sweets that must be distributed to the prisoners. The jailer decides the fairest way to do this is ...
3
votes
2answers
34 views

Getting the smallest snippet from content containing all keywords

This returns the smallest snippet from the content containing all of the given keywords (in any order). This provides the correct solution but I would like to know if it can be made more efficient. <...
4
votes
4answers
183 views

Poker Hand Evaluator

Poker is 52 cards - 4 suite and 13 rank: Hand is exaclty 5 cards Order of hands Straight-flush - all same suite and in order Quad four of same rank Boat three of one rank and two of another rank ...
5
votes
1answer
69 views
+50

Find installed and available Windows Updates

I have a function that uses Windows Update Agent (WUA) API through COM using the win32com.client module, part of pywin32 package for retrieving the installed and the available (not yet installed) ...
2
votes
1answer
49 views

Optimizing Java HTML parser

I wrote a program that goes through a webpage and returns matches of regex. I used it on my letterboxd.com account to go through all of my movies (over 900 entries) and then find genres field for each ...
2
votes
1answer
36 views

Find offset that minimizes squared difference between two vectors of different size

I am working on a project where the hotspot is some code that is supposed to find an offset, such that the squared differences between a reference vector and a given vector becomes minimal. The core ...
7
votes
2answers
119 views

Game of Fifteen - A Sliding Puzzle Game

Update: I addressed the changes and created an updated post. I'm reviewing C by working through the edX CS50 problem sets. This task was to implement Game of Fifteen aka 15 Puzzle. Project details ...
1
vote
0answers
20 views

Functional Merge Sort

I just finished this Merge Sort in Clojure, structured according to ex. 22-26 of this workshop. The main question I have can be answered without spending time understanding the code: ...
4
votes
2answers
37 views

Parsing shorts from binary file and finding the closest and furthest points

A few months ago I got rejected at the technical interview for a position. The problem that they gave me is the following: From a binary file, parse two shorts, x and y and build a Point object with ...
0
votes
1answer
12 views

Efficient ways of looking for start-key and processing data

This question is a follow up from my previous question. I am working with some wireless communication in Arduino. 979797 is the address of the transmitter. I have written the following code to ...
2
votes
0answers
27 views

Unbounded knapsack solution with items of equal value

My solution correctly solves the problem, but I would like to optimize its performance. For a capacity of 7 and bars = [ 4, 1, 1, 2, 1], the output is 7. ...
13
votes
3answers
649 views

2-sum problem on a range in Python

Here is the problem description (from an algorithm course: https://www.coursera.org/learn/algorithm-design-analysis): The goal of this problem is to implement a variant of the 2-SUM algorithm (...
4
votes
4answers
633 views

Find Watson's integer

Problem Statement: Watson gives Sherlock an array \$A_1\$, \$A_2\$ ... \$A_N\$. He asks him to find an integer \$M\$ between \$P\$ and \$Q\$ (both inclusive), such that, \$\min \{|A_i-M|, 1 \le i \...
3
votes
1answer
76 views

code that looks for a pattern

I've created this function. It looks for sequences, in a list. If [1,2,3] exist, it will print True I've tested the code and ...
5
votes
1answer
29 views

Improving CSV filtering with Python using regex

Consider a .csv file that contains a set of video names like so: ...
2
votes
2answers
54 views

Reading genetic data in VCF and Tabix formats using an asynchronous library

I'm working with an open-source library for processing and parsing genetic data in VCF and Tabix formats. It contains functions and classes that make it easy to read an index file (a Tabix) and load ...
1
vote
1answer
52 views

Java password encryption based on time and string

I have a program that: Takes a user specified string Creates password from the string and previous, current, and next day Encrypts the strings Chops some middle characters from the strings (needed ...
7
votes
2answers
109 views

Program to find magic square of squares

I have a program which finds, well, a magic square of squares. The problem is, it's quite slow - it processes around 50 numbers in half a second when the number range is above 40,000. Is there any ...
4
votes
2answers
88 views

Clojure performance for solving Project Euler 72 (counting proper reduced fractions)

This is a solution of Project Euler 72 in Java. How may proper reduced fractions \$\dfrac{n}{d}\$ are there, where \$n < d \le 10^6\$? ...
8
votes
1answer
60 views

Process bytes and check for start key

I am working with some wireless communication in Arduino. My data will be wirelessly received like so: 97 97 97 ... ... 979797 is the address of the transmitter. ...
3
votes
0answers
55 views

Query for a ticket system involving cases and casts on many attributes

I have this SELECT statement that inserts into a temp table and it is slow! Right now it takes ~1500 ms to run and only deals with ~7000 rows. As the data grows ...
6
votes
1answer
497 views

Python search for array in large text file

I asked similar question at: http://stackoverflow.com/questions/38410982/superfast-regexmatch-in-large-text-file ...
0
votes
1answer
39 views

Android music-streaming app

This is my first time building an Android app or even using Java in the first place. All of this code does work, but I'm hoping to optimize it or find out if things could be done more easily than how ...
3
votes
0answers
27 views

Fade and slide animatable elements on window scroll

I wrote a simple JavaScript function to animate objects on my webpage to fade and slide in from the bottom of the screen when the user scrolls them into view. I did this by using JavaScript to add ...
6
votes
1answer
146 views

Update bitmap in picturebox with data from a socket

I'm working on a screen sharing project, and I receive a small block of images from a Socket constantly. I need to update them on a certain initial desktop bitmap I ...
8
votes
1answer
85 views

I CAN HAS EULR 14, PLZ?

A few days ago I found myself learning lolcode. It turns out it's (almost) a real language and capable of handling (pseudo-)serious problems. So, let's try some (pseudo-)serious code this time. ...
1
vote
0answers
23 views

Generic Pairing Heap Performance

I have made a generic pairing heap library in C. Pairing heaps are one of the several heap variants with better asymptotic running times than standard binary heaps (others include Fibonacci heaps and ...
5
votes
1answer
68 views

Generalized Project Euler 2: A sledgehammer to crack a nut

The task at hand I have previously asked about how optimizing Project Euler 1. See Generalized Project Euler 1: A sledgehammer to crack a nut. In this question I wanted to explore the next problem: ...
2
votes
0answers
23 views

didSimulatePhysics to animate a ball, taking 45% of CPU

According to my time profiler this is taking 45% of my cpu usage: have tried to optimize, and someone on stack overflow -- recommended to post here. Time profiler says 99% of the time is spent on the ...
3
votes
1answer
25 views

Filling in gym membership prices by joining PANDAS dataframes

I have two dataframes, df which contains a list of members in addition to the type of contract that they purchased on a given date, ...