Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
1
vote
0answers
22 views
Simple multi-dimensional Array class in C++11 - follow-up
Last week, I posted this question in order to get some comments and critiques on a simple implementation of a multidimensional array class -- hyper_array::array ...
5
votes
0answers
32 views
Fastest possible Cython for Black-Scholes algorithm
I started with a pure python implementation, and have been trying to get the performance as close to native C as possible using numpy, numexpr, and cython. Here is the the numpy version that I ...
5
votes
1answer
33 views
Solver for a number-game (8-queens applied to Sudoku)
Since I while ago I've been addicted to a number-game that you can think of as a binary Sudoku. The game is called (in Italian) Alberi (trees) and I haven't found any equivalent when searching the ...
3
votes
0answers
11 views
Optimizing HLSL shader
I am trying to optimize my vertex and pixel shader code. Do you have any suggestions what could I possibly do to improve performance? I am using it to draw textured cuboids, and if there are many ...
8
votes
2answers
97 views
SSE instruction to check if byte array is zeroes C#
My fundamental problem is how to check whether byte[] is full of zeroes. I posted a range of implementations (with timings) and one clearly beats others. In fact, ...
1
vote
2answers
249 views
Binary tree data structure
I am learning about the binary tree data structure and implemented some basic functionality.
It was working great with module level functions until I realized that I need to keep track of the root ...
2
votes
1answer
23 views
Extract data from large JSON and find frequency of contiguous sub lists
I have been writing some code (see component parts here and here) that:
Takes a very large JSON (15GB gzipped, ~10million records)
Extracts the relevant parts of the JSON into a list of lists
...
1
vote
0answers
11 views
Text box intuitive user-interaction using focus listeners
This code aims to replace labels used to explain a text box's container. This is done by adding a default string when the text box is considered empty to explain the purpose of the text box. However, ...
6
votes
1answer
61 views
Sum of primes in given range in Go
This piece of code calculates the sum of all prime numbers below 1 million.
It stood out to me that the Ruby script is around 20% faster. I know that Go should be faster just for being a compiled ...
4
votes
1answer
28 views
Slicing time spans into calendar months
I have apparently correct code that still runs for weeks on my data (tens of millions of rows). I show the entire code for reference (and maybe other gains to be made), but the key operation is in the ...
3
votes
2answers
37 views
Getting a hash string for a very large file
After reading about large files and memory problems, I'm suspecting that my code below may be inefficient because it reads the entire files into memory before applying the hash algorithm. Is there a ...
4
votes
2answers
57 views
Assembling very large files
I have users uploading files sometimes as large as 100+ GB to a local web server. The upload process works well and chunks come in at 50MB. The problem seems to be after the file is uploaded, when ...
4
votes
1answer
42 views
Sieve of Eratosthenes Primes Efficiency
I'm fairly new to Java and was trying to make a program thats generates the primes from 2 - 100. I originally had a design of my own making but it was fairly inefficient so I did some research and ...
4
votes
2answers
55 views
Two string comparison
I wrote a function that finds the difference between two strings. This only works given that the difference is continuous.
Beyond doubt this already exists, I am recreating this for educational ...
2
votes
1answer
89 views
3
votes
1answer
49 views
Alternating Direction Method of Multipliers
This is a python implementation of the Alternating Direction Method of Multipliers - a method of constrained optimisation that is used widely in statistics (http://stanford.edu/~boyd/admm.html).
...
2
votes
2answers
74 views
Solving for equilibrium index in an array
I did a sample on Codility and finished the test task.
The problem description is very short:
The equilibrium index of a sequence is an index such that the sum of elements at lower indexes is ...
1
vote
2answers
88 views
Determining if two strings are anagrams
Two strings are said to be anagrams of each other if the letters of
one string may be rearranged to make the other string. For example,
the words 'elvis' and 'lives' are anagrams.
In this ...
1
vote
2answers
41 views
Scraping and using JSON data from thousands of files in a directory
I have a few thousand json files containing order histories sitting in a directory from one of our systems. Since customers can opt in to receive marketing I'm opening each json file and then ...
2
votes
2answers
47 views
Iterate over large amount of words in Python
I wrote a program that should check a dictionary that contains about 50000 other dictionaries. In those dictionaries, one of the keys has a list of words as value. Now, I iterate over those words, ...
4
votes
2answers
34 views
Speeding Up BufferedWriter
Are there any possible speed improvements I can make to the following method. It takes a JDBC ResultSet and breaks it into several CSV files:
...
4
votes
1answer
19 views
DuckyScript precompiler for Arduino Leonardo
I've made a python program to convert DuckyScript code to Arduino code for Leonardo boards. Below you can find both the project files and a sample script.
...
2
votes
2answers
61 views
Mnenomic Password Generator
I have this code that creates unique passwords using the first letter of each word from the file. Before each password is created (written to a file) it is compared to all passwords that are currently ...
1
vote
0answers
33 views
Downloading html documents from the web takes too much time
In this project i'm working on, I need to extract articles text from their original html document. This class, HtmlConnection, recieves the URL of the article, and ...
2
votes
3answers
168 views
Remove repetitive strings from a given sentence efficiently
I recently gave a test on HackerRank:
Given a string, return the most concise string that can be formed from it.
For example:
...
2
votes
3answers
60 views
Creating a tuple from a CSV file
I have written code that reads in a CSV file and creates a tuple from all the items in a group. The group ID is in column 1 of the table and the item name is in column 2. The actual datafile is ~500M ...
2
votes
1answer
46 views
Optimize program to test for divisibility of numbers 3.0
This is a follow up on my previous question.
JS1's answer suggested that I should use a precomputed table containing all permutations of the lowest valid number for each number between 1 and MAX. It ...
3
votes
1answer
46 views
Finding most common contiguous sub-lists in an array of lists
Objective: Given a set of sequences ( eg: step1->step2->step3, step1->step3->step5) ) arranged in an array of lists, count the number of times every contiguous sub-lists occur
Where I need your help:
...
4
votes
1answer
83 views
Read Twitter users from a text file
I have this code for reading Twitter users from a text file represented by integers in the format "int (space) int", where the first int is the ID of
the user doing ...
3
votes
1answer
59 views
Testing for divisibility of numbers - follow-up
(Here is the follow up question)
I had another go at trying to speed up my program described in my previous question.
JS1's answer was particulary helpful and now my code is only about 20% slower ...
2
votes
3answers
76 views
List comprehension method
I have developed some Python code which revolves around two custom classes - a 'Library' class (Lib) which contains a Python list of several objects based on a 'Cas' class. I've not posted the code ...
1
vote
1answer
56 views
Simple neural-network simulation in C++ (Round 3)
As I mentioned at the end of my Round 2 answer, I've needed to expand my code in order to produce faithfully the data needed for Figure 1 of this paper.
Unfortunately, the updates have made my script ...
2
votes
2answers
430 views
Efficient algorithm for counting frequency of a numbers in intervals
I need to build a bar graph that illustrate a distribution of pseudorandom numbers that determined by linear congruential method
$$X_n+1 = (a X_n + c) \mod m$$
$$U = X/m$$
on the interval [0,1]
...
2
votes
1answer
79 views
Inversion count via divide and conquer
I'm happy to hear thoughts and ideas on structure/performance/testing/whatever and multi-threading, which I haven't gotten into yet with Python.
Full code here. Assignment file and a test file ...
2
votes
1answer
31 views
node.js CPU issue
Me and my friend are making a node.js game, and we have been testing cpu, but after profiling this process called zlib is sucking most of the CPU/RAM
3 clients connected to a game is fine, but when ...
6
votes
1answer
78 views
Simple multi-dimensional Array class in C++11
The new version of can be reviewed in Simple multi-dimensional Array class in C++11 - follow-up.
The following code implements a simple multi-dimensional array class (...
5
votes
2answers
113 views
Find the next prime number — flow control of nested `for` loops
This code works perfectly, but it bothers me. Having a labeled, nested for loop, with a true condition, a ...
3
votes
1answer
66 views
Using LINQ to perform a LEFT OUTER JOIN in 2 DataTables (Multiples criteria)
I know that exists a lot of solutions about how to create an OUTER JOIN between two DataTables.
I created the following code in ...
8
votes
4answers
390 views
Simple GCD utility in Java
I previously discussed the performance concerns about different GCD algorithms. I wrote a simple Java class that implements the Binary GCD algorithm. It is a really tiny class that has only two ...
3
votes
1answer
115 views
Simple neural-network simulation in C++ (Round 2)
Intro
Yesterday I posted this question. Since then, I've updated my code to incorporate these suggestions. I've also removed the dependence on C++11. Finally, I've made the following changes that ...
-3
votes
0answers
30 views
optimize python3 code in competitive programming [closed]
the following codes from python3 and C++ do the same job
...
2
votes
0answers
55 views
JavaScript library for material design toasts (notifications)
This question is a follow-up question to this one.
I wrote a small JavaScript library for material design toasts (notifications). I'd like to know what are my mistakes and how can I correct them? ...
2
votes
1answer
38 views
4
votes
1answer
42 views
Find values in list which sum to a given value within tolerance
This is really a follow on from a question I asked earlier this year on Stack Overflow. I received a great answer to the following problem:
I'm trying to code up something simple and pythonic to ...
3
votes
1answer
45 views
Grouping two sets of data
The following method retrieves a list of users and the subscriptions for each user, from my database. That said, it works, but it runs pretty dang slow. I'd like to improve the speed on it. Currently, ...
2
votes
0answers
43 views
Compute the box covering on a graph using CPython
Edit:
My initial idea was to use numpy to solve efficiently this problem but after trying without results, someone comment on stackoverflow:
"Numpy can speed things up a lot IF your problem is ...
1
vote
2answers
50 views
Database migration script
I'm working on a database migration script written in python, which will take data from a MySQL database and insert them into a PostgreSQL database with a different Schema (different table structures, ...
2
votes
2answers
76 views
Program to test for divisibility of numbers
(EDIT: here is the follow up qusetion)
Using this program to test for the smallest number where its permutations or itself is divisible by 10 or less numbers is twice as slow as the fastest program I ...
4
votes
2answers
81 views
Sort array of Numbers with some values always first
The first number will be dynamically selected and remaining array should be sorted ascending
...
1
vote
1answer
35 views
Find permutation of a specified lexicographic rank
This is one result of my work on Project Euler to learn Java. I'm interested in how well this conforms to best practices as well as any recommendations on efficiency. (I'm pretty sure this code is a ...