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
1answer
27 views
0
votes
0answers
24 views
Permutations with repetitions algorithm in R
Given a string of length n, print all permutation of the given string.
The code bellow generates all permutations (with repetitions) for the given string and stores them in object ...
1
vote
0answers
14 views
Parsing .PLY file using F#
I'm fairly new to F# and have written a program to parse PLY files - this is however done in an imperative way with mutable values and as far as I know that should be avoided in functional languages.
...
7
votes
2answers
54 views
Bucket sort in Haskell
As a first step in learning Haskell I am solving this problem, which involves finding the Rith-ranked numbers, given some input list and many Ri. In an imperative language I would make a zeroed array ...
4
votes
2answers
240 views
Find prime positioned prime number
This is a question from programming contest. This contest is already over.
Now, all the prime numbers are arranged sequentially in ascending order. i.e:- 2, 3, 5,7...and so on. Now, your task is to ...
4
votes
2answers
69 views
Project Euler #23 Non-abundant sums
I'm having trouble optimizing the Project Euler problem number 23 :
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of ...
1
vote
0answers
39 views
Transforming a parts catalog into a different data structure
The entire purpose of this code is to arrange the data that was dumped into CommRef_ into the required structure of ResObj.
The ...
5
votes
2answers
59 views
Calculating the perfect squares between two given numbers
This code is for calculating the perfect squares between two given numbers. User can add the interval as well like for how many intervals he want to check the perfect squares. For example if user ...
1
vote
1answer
87 views
Getting price for one firm by week
I've a lot of data whit prices of a product from different firms by week. I've a class named WeekPrice witch contains a list of ...
2
votes
2answers
67 views
2
votes
1answer
31 views
3D bin packing in java (compare two codes)
I made some changes to the first code here I wrote and I want to know which one is more correct logically (before the changes or after the changes)
It's really hard to manually test these kind of ...
1
vote
0answers
23 views
Caching calculation results in R
Here is what I came to for calculation result caching/invalidating. What do you think?
How to use:
...
2
votes
0answers
37 views
UDP server for a multiplayer game using socketserver
I am making a multiplayer platforming game, and currently there are server performance issues once I have about 7+ clients connected. I was told earlier last week that I should investigate ...
3
votes
1answer
32 views
3D bin packing algorithm using Java?
I wrote a 3D bin packing algorithm but I am still not sure if it is correct or not.
I did not follow any code or pseudo-code that's why I would like to know if it is an efficient algorithm for the 3D ...
2
votes
2answers
75 views
Integer to English challenge
I have a challenge, which is to create a JavaScript function that turns a given number into the string representation. For example:
console.log(inToEnglish(15)) ...
1
vote
2answers
17 views
Python 2.7 Script for checking literary works for Zipf's Law
As the title suggests, I wrote a python script that, given a literary work in text file format, takes it apart, makes a word list, counts how many times each words appears in the literary work, and ...
1
vote
2answers
39 views
Game engine for 2D games in Java
I am writing a 2D game engine library that I can use for simple future games, and I've been told that it is written very procedural rather than objected oriented. I was wondering what I should do to ...
3
votes
1answer
51 views
Two solutions to Project Euler 12, but one is drastically faster
My code for #12 (first triangular number with over 500 divisors) is as follows:
...
20
votes
7answers
5k views
Project Euler #7 10001st prime
I decided to start working on the Euler project exercises. I'm doing fine for now but the seventh problem is running quite slow and I can't think of anything to make it work faster. It takes around ...
6
votes
1answer
57 views
Eraser tool for GIF editor
I am making a GIF editor in C#, and I am currently working on the eraser tool. I am not sure what I can do to make it more efficient, because when I make the thickness (diameter) more than 30 (pixels) ...
6
votes
1answer
35 views
Thread-safe algorithm to make trades based on moving window of prices
Here is problem to be solved
TradingAlgorithm employs a trading algorithm which, based on the prices it receives, will return a trade to execute.
The trading algorithm must implement the ...
3
votes
1answer
65 views
Parsing speech out of text
I'm working on an experiment to parse speech out of an emote in a text roleplaying game (MUD) so that if you can't hear it correctly, or if it's in a different language, you won't understand it. This ...
4
votes
2answers
62 views
Product of 2 numbers equals sum of numbers between them
Problem: Find all the pairs (a, b) whose product is equal to the sum of all numbers in the sequence [1..n] excluding both a and b.
I have made code for one program and need refactoring for code to ...
9
votes
2answers
94 views
Java hex dumper
Can somebody please try and help me speed up my code? The file is ~12MB (you can download it here). It takes around 500-600 milliseconds to run on my i7 4790k.
...
1
vote
1answer
46 views
DBSCAN in C++ for general and Android use
I've implemented a templated DBSCAN for general use. At the moment, it's going to be used on Android through the JNI. I used Wikipedia's pseudocode and a little bit of the DBSCAN paper for reference. ...
3
votes
1answer
56 views
Generating a maximal geometric progression of integers
I'm working on a program that generates a maximal geometric progression of at least 3 integers when given a number that the greatest value shouldn't exceed.
My current code works, and it's quick(ish) ...
4
votes
2answers
81 views
Parsing a string as fast as possible that is using comma delimiters
I have made a simple static parser for a bigger program. This parser takes a string that has comma deliminators and I need to separate the strings in to a vector for handling in a different section of ...
1
vote
2answers
43 views
Project Euler - Smallest multiple (Ruby)
My code is very slow to run, and I am trying to find a way to make it more efficient. I know there must be a better way than to write each modulo operation.
The goal of the script is to find the ...
1
vote
1answer
25 views
Using Pexpect for communication between multiple programs via I/O
I have a Python script that runs three compiled programs and makes them communicate via standard I/O. This is my first time using pexpect. My program runs very ...
2
votes
1answer
51 views
Finding corners from Line arrays
I have the following code that takes input of Line arrays and attempts to find the intersections on the end points between them. The value ...
1
vote
1answer
33 views
Finding the nearby points from an array
I have the following code that takes a Point and a given tolerance value and looks for all other Points that fall within the ...
2
votes
3answers
138 views
Search in a big dictionary Python
I have a big Python dictionary with more then 150,000 keys every key has list value. This dictionary contains infinitive words as key and all grammatical forms of these words as values:
...
27
votes
7answers
2k views
Mandelbrot image generator and viewer
This is a C++ program which outputs a Mandelbrot fractal image in a graphics window and lets the user zoom and pan around the image, generating a new image each time the user does so. I'm using SFML ...
5
votes
3answers
60 views
Extracting information from spreadsheet into 12 tables (one per month)
I have a file with more than 100k rows, but the structure is simple:
...
0
votes
0answers
23 views
Angular.JS directive to show 225 items in a grid
I'm a newbie in angularjs who has been tasked with optimizing this code.
The following directive lists information in a table. The table uses pagination with 25 items per page and 11 items that can ...
-2
votes
1answer
30 views
Writing clean and efficient recursive function
How would you rewrite this function, to be as much readable as possible, while containing minimum lines and being not much slower:
...
5
votes
2answers
181 views
Splitting text into n-grams and analyzing statistics on them
I have made the algorithm that split text into n-grams (collocations) and it counts probabilities and other statistics of this collocations. When file is more then 50 megabytes it takes long time to ...
2
votes
1answer
36 views
Calculate temperature based on differing regression coefficients
The following function calculates temperature based off of a given suction pressure, where different regression coefficients are assigned depending on the value of the pressure.
The regression ...
2
votes
0answers
55 views
Processing keyboard input for player movement in a game
The following code is part of a game I am making using the Phaser framework; the game is in the style of a top-down RPG, with the player moving their character in four possible directions using the ...
8
votes
2answers
569 views
Comparing two strings to see if string 2 is inside string 1
Here is what I have to do:
Write a function scramble(str1,str2) that returns true if a portion of ...
0
votes
1answer
37 views
Python + spark to parse and save logs
I need to parse logs and have got following code. I can see two problems: map().filter() may induce some performance penalties and copy-paste block
parser.py:
...
0
votes
1answer
23 views
Optimizing Codegeneration from Ast
I have been writing a compiler. While profiling the compiler, one method takes 5 seconds to compile 2k lines of code, my profiler tells me that this is the bottleneck.
...
4
votes
3answers
196 views
Finding the fastest common prefix of 2 strings in Python
I'm comparing my algorithms, slice_prefix and bit_prefix, with existing ones to find the common prefix length of 2 strings as ...
0
votes
0answers
28 views
Prompt to pay for in-app purchases
I have the following code that prompts the user to pay for an in-app purchase when they click a button. I was wondering whether it was efficient or not:
...
2
votes
2answers
67 views
Intentional performance degradation through cache and branch-prediction misses
I am experimenting with performance evaluation. From the hardware architecture point of view, two main factors are cache misses and incorrect prediction of conditional branches which can degrade the ...
1
vote
1answer
54 views
Python Pandas Apply with a Lambda Function
I have a table in pandas that has two columns, QuarterHourDimID and StartDateDimID ; these columns give me an ID for each date / ...
1
vote
0answers
33 views
A bitwise common prefix algorithm in Python
Is my algorithm slow because it has problems? Or, is any bitwise common prefix solution not going to give me the performance I'm looking for?
After profiling my algorithm, I found that over 60% of ...
1
vote
1answer
59 views
Returning a collection of unique elements: List<T> using Contains() or HashSet<T>
I'm writing a binary PowerShell module and have recently started to add wildcard support to some cmdlets.
I'm not sure if I'm using an efficient way of creating the final collection of objects to ...
2
votes
1answer
36 views
Script that retrieves trending topics from Twitter
The following code fetches trending topics from Twitter's API using a WOEID. It caches the response, loading from this cache the next time if its relatively fresh (generated within the last 15 ...
3
votes
1answer
28 views
Splitting apart a comma separated list
I have a system that outputs a comma separated string into a single column. I need to grab the individual values out of that list. The list could have random spaces and commas that need to be ...