Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
0
votes
0answers
9 views
Testing current, new or friends firms as max output and least effort
I have a firms dynamics program (fully based on Axtell, 2013) that runs very fast, except for the function below. Could anybody point to more pythonic ways to write this function? (I use numba, tried ...
1
vote
2answers
16 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
0answers
23 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
44 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:
...
13
votes
6answers
2k 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 ...
3
votes
0answers
34 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) ...
5
votes
0answers
28 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
63 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 ...
3
votes
1answer
43 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 ...
8
votes
2answers
72 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
39 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
55 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) ...
3
votes
2answers
55 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
40 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
22 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
50 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
123 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:
...
26
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
48 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
22 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
29 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
174 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 ...
1
vote
1answer
35 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
54 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
562 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
35 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
192 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
27 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
48 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
30 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
58 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
33 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 ...
-2
votes
1answer
37 views
0
votes
0answers
45 views
Helper method to find VisualChildren of multiple Types
I created an helper method to return a List of UIElements where the returned elements have to match with one of the ...
5
votes
2answers
50 views
Replacing accented letters with regular letters in a spreadsheet
I am using the following VBA code to replace accented letters with regular letters in a spreadsheet. This is necessary because these spreadsheets have to be uploaded to an import tool that does not ...
3
votes
2answers
48 views
Excel VBA highlighting macro
I have this Excel macro I created to highlight all instances of a number if at least one instance is already highlighted before running the macro.
...
1
vote
2answers
96 views
Encryption algorithm using CTR mode
I am using CTR mode (it is a cipher in itself) in this code. I just wanted to see what you thought about it before I finish it.
(Yes, I know that the plaintext length and key length must be highly ...
3
votes
1answer
35 views
Word Wrapping and Boxing
This was an experiment to take any text and wrap it to a given number of columns. It also wraps
the text in just one box, lets you box multiple blocks of text, and also lets you limit the number
of ...
9
votes
2answers
286 views
Circular Buffer in C - Follow Up
This is a follow up to this post I uploaded a few days back on my alternative account about a circular buffer in C. I'm confident that I fixed most of the warnings and even added an iterator.
...
3
votes
2answers
62 views
Filtering numeric vectors by proximity to any elements of another vector in R
I frequently want to filter and select elements from a long (10,000s to millions of elements) vector in R. Often, this vector is a column in a data.frame. I am ...
0
votes
1answer
38 views
Laravel bulk insert optimization
I'm currently using a make shift INSERT on DUPLICATE UPDATE function that relies on a DB raw query from eloquent. I'm looking to improve the quality of the code and the speed. Please take a look
...
2
votes
2answers
33 views
Sending an SMS message using zenoss and python
I have just finished a simple python script which uses this module to call Zenoss API for getting live events. What the script does:
connects to zenoss
reads a file which has one phone number on ...
3
votes
0answers
40 views
REST API calls to BIG-IP LTM to get the status of pool members
This code calls the iControl REST API provided by BIG-IP LTM. Trying to get the list of the pools, it's current status and the pool members associated with the pool.
My code works like this, based on ...
0
votes
2answers
44 views
Notify owner of post and other commenters
I have a rails4 app. When a user comments on a post it should send a notification to all the guys who commented on the post and to the post creator. I have a working method in the controller, but it's ...
2
votes
1answer
48 views
3
votes
1answer
54 views
Explosion animation plugin for a game
I have been writing a small particle plugin since I want to learn how physics works for games. Now I have tried to get this as clean as I possible could but It feels something is missing. Am I ...