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)

0
votes
0answers
19 views

SICP - exercise 2.5 - representing pairs of nonnegative integers using only numbers and arithmetic operations

From SICP Exercise 2.5: Show that we can represent pairs of nonnegative integers using only numbers and arithmetic operations if we represent the pair a and b as the integer that is the product ...
2
votes
1answer
16 views

Replacing elements from a list and its sublists - part II

This is sort of a follow-up to Replacing elements from a list and its sublists but now there are arbitrary numbers of words that would be replaced stored in a list. Now write substitute2 that takes ...
3
votes
0answers
15 views

Extension of PHP `round()` for PHP_ROUND_UP and PHP_ROUND_DOWN - follow-up

The original question can be found here. While looking at PHP.net this afternoon, I saw a comment in round() for two functions for rounding ...
1
vote
2answers
28 views

SICP - exercise 2.20 - same-parity

Exercise 2.20.   The procedures +, *, and list take arbitrary numbers of arguments. One way to define such procedures is to use define with dotted-tail notation. In a procedure definition, a ...
1
vote
1answer
21 views

Extension of PHP `round()` for PHP_ROUND_UP and PHP_ROUND_DOWN

While looking at PHP.net this afternoon, I saw a comment in round() for two functions for rounding UP and ...
1
vote
0answers
31 views

Async process to send a contact email and confirmation message

Using nodemailer and node-email-templates to send a contact email and confirmation message. As is, I can catch any errors, but (if a file attachment is included), this process can take up to 30 secs ...
1
vote
0answers
13 views

collect and parallelize in spark performance

the below code is working fine, but as this is new for me, please help to improve performance. as I have not included yet my complex logic but confused over collect and parallelize. Aim is to collect ...
2
votes
0answers
24 views

Parallel reduction by key implementations

I have an implementation of the reduction approach used in this document. Furthermore, I extended (crudely) this so I can reduce-by-key. In my setup I can assume that a ...
7
votes
2answers
362 views

Maximum product of word lengths in Python

Problems was to calculate maximum product of word lengths: Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the ...
3
votes
1answer
31 views

Reversing a list without (append)

I would like to reverse a list using cdr, car and cons. Since lists in lisp are asymmetrical (can only insert at the beginning), I am interested on how one would write a procedure to do that without ...
3
votes
1answer
40 views

Replacing elements from a list and its sublists

Write a procedure substitute that takes three arguments: a list, an old word, and a new word. It should return a copy of the list, but with every occurrence of the old word replaced by the new word, ...
8
votes
2answers
285 views

Calculate volume of a cylinder with user input

I'm looking for a fast OR simple way to calculate the volume of a user-entered cylinder. Here is my solution: ...
7
votes
1answer
51 views

Travelling Salesman problem using GA, mutation, and crossover

I created a short python program that can create a list of random unique nodes with a given length and a given number of strategies. The GA runs through a given number of generations, changing a ...
14
votes
3answers
929 views

A library to do maths with matrices written from scratch

Background Some time ago I've encountered some very good articles about neural networks that represented an ANN as a set of matrices, so everything was done using matrix operations. These articles ...
6
votes
1answer
58 views

Pick sequences of numbers to maximize the points

It is a single-player game. In the beginning, there is a row of integers. In one move the player can take a certain amount of adjacent numbers (let's denote it T). Then the player's points increase ...
4
votes
2answers
90 views

Backtracing Sudoku solver

I have made a backtracking Sudoku solver in Python but it's working quite slow. Originally, It had been working on 4 by 4 grids, which worked fine. But now, trying to solve 9 by 9 grids takes a very ...
7
votes
3answers
68 views

Finding if sequential numbers for total exists

Question: Given a sequence of positive integers A and an integer T, return whether there is a continuous sequence of A that sums up to exactly T Example: ...
5
votes
3answers
121 views

Faster finding of all cubic numbers

I want to improve the performance of this program. ...
-1
votes
0answers
23 views

analyze the performance of Curvature Filter [closed]

I developed some image filters, named curvature filter. I spent a lot of time in optimizing the code and try to make it faster. But my programming experience is limited and I believe that there still ...
5
votes
0answers
25 views

Report for a restaurant showing hourly sales information for a given timespan

I have been tasked with creating a report for a high-volume restaurant that shows hourly sales information for a given timespan. When generating this report for a single day, it's very quick, but when ...
-5
votes
0answers
16 views

Why am I getting NZEC(Non zero exit code)? [closed]

The question was on codechef(https://www.codechef.com/problems/SSWAP2) ...
7
votes
2answers
112 views

Calculate middle values faster

I want to improve the performance of this code: ...
6
votes
1answer
51 views

Remove duplicates in list of lists where item in each list is ignored when determining duplicity

I have lines_list_copy of the form: [['a1', 'b1', 'c1', 'd1', 'e1'], ['a2', 'b2', 'c2', 'd2', 'e2'], ... ] I needed to ...
8
votes
2answers
51 views

Iterate list to map entries in Python

I have two files, namely: File1: CL1 AA XX YY ZZ SS \n CL2 3_b AA File2: AA string1 AA string2 3_b string3 My ...
6
votes
3answers
308 views

Sum of orders per customer ID

So, I have two tables, customers and orders and I want to get all orders associated with a customer. The tables look like this: ...
8
votes
3answers
310 views

Drawing a grid on canvas

I have created canvas (800x400) - and filled it with a grid. It works but the rendering of the grid (lines) takes around 3 seconds, which seems excessively long. Am I doing something wrong? ...
5
votes
2answers
81 views

Extending Sieve of Eratosthenes beyond a billion - follow-up

Follow up form Extending Sieve of Eratosthenes beyond a billion Taking suggestions from the comments on the previous post: Updated Code: This takes about 22 seconds for MAX as \$10^9\$ to reach ...
4
votes
2answers
223 views

Function to split either a string array or string into a string array

I am programming a language interpreter in c# recently and i have created a set of functions that receive either a string or a string[] and splits it by a received string. For example: with a string ...
8
votes
2answers
91 views

Function to find the kth match (2)

code from suggestions in comments here. I will still write it like the first time, so you do not need to read the old question. I've created a UDF some time ago and used it pretty often till now in ...
11
votes
1answer
57 views

iterating over the values of a list of ordered dictionaries

I am facing the following problem: I have a special data structure that is a dictionary whose keys are integers (dimensions). The values are also dictionaries whose keys are strings (geometric types) ...
13
votes
2answers
88 views

Getting to Wikipedia's “Philosophy” article using Python

On Wikipedia, if you click the first non-italicised internal link in the main text of an article that's not within parentheses, and then repeat the process, you usually end up on the "Philosophy" ...
5
votes
2answers
92 views

List all repeated substrings with a fixed length

While fiddling around, I've made a very simple and naive function to retrieve any repeated sub-string within a certain string. ...
11
votes
1answer
242 views

Where it all begins: Khronos

This is the main.c file for Khronos, a personal project of mine. This is basically where the whole program is setup, run and then quit. I'll post the short ...
23
votes
4answers
1k views

Extending Sieve of Eratosthenes beyond a billion

For MAX value of 1000000000 (\$10^9\$), it takes about 45 seconds to reach the line where it prints "done". How can I speed this ...
10
votes
1answer
132 views

Binary heap performance optimization

I have implemented a binary heap as a exercise in data structures. I realize that I'm missing some useful functions (increase/decrease key for example) but I don't consider them interesting for the ...
10
votes
1answer
58 views

Shift Operator Multiplier

Please suggest a way to optimize the below code. I want to reduce the execution time. This is a program to multiply using the shift operator. ...
10
votes
1answer
56 views

Function to find the kth match

I've created a UDF some time ago and used it pretty often till now in different ways (but mainly to compare a "history" of data like having different filters at the same time). While there is no need ...
3
votes
0answers
41 views

RecyclerView lags on scrolling

I'm having an issue where when the recyclerview has a big amount of items (say 2000) the scrolling is really laggy. Here's the Fragment code: ...
4
votes
2answers
107 views

Converting hex to integer

What's the fastest way of doing this? ...
8
votes
2answers
75 views

A 3-D vector class built on top of numpy.array

I wanted a convenient class to easy access the parameters inside. I am using a lot of math in my game; that's why a wanted to access them through x, ...
12
votes
1answer
105 views

Fast 32x32 bit multiply on ARM M0

I have a time-critical calculation running on an ARM Cortex-M0. This is the fastest 32x32 bit -> 64 bit multiplication that I can come up with. The following C compiles almost 1-1 to assembly ...
8
votes
0answers
47 views

Go database helper code

Today I've implemented a database helper in Go. I'm new in Go world so I just wanted someone with more experience to take a look and tell me what is good and especially, what is bad (and why, if ...
-1
votes
2answers
127 views

Delete rows quicker [closed]

I have worked on some VBA code for past couple of days and everything seems to be working fine till one fine day when I added the below code to it. The execution time increased to such an extent that ...
6
votes
1answer
109 views

Joining datatables to create a new datatable

I am joining datatables to create a new datatable: ...
7
votes
2answers
84 views

Repeating a std::string n times

I recently posted an answer to this SO question as I did not think any of the current answers were satisfactory (most don't even answer the question!). I was wondering if anyone could offer any ...
5
votes
0answers
52 views
+50

TabLayout inside fragment fetch data from web

I am working in project that I use Tablayout inside fragment. I have three tabs where they fetch data from web service. This part of the app shows questions. We ...
12
votes
1answer
61 views

Query to count interactions between users

The source data represents interaction between people. Some are internal, others are external. The internals are recorded in the Users table (represented as the ...
7
votes
2answers
112 views

Frequency count of single words and word pairs over 20 million tweets

My application needs to read 20-million-line text files and count the word frequencies for one and two words. For example: A B A B SSS G D A One word Frequency A: 3 B: 2 SSS: 1 G: 1 Two ...
10
votes
2answers
92 views

Simulation of image transfer over noisy channel

Following this question, I've tried to rewrite some core methods to avoid using String for bit operations, and I ended up using ...
9
votes
2answers
65 views

Extract values within date and zone ranges

In order to automate a manual task I created the following code. As I've never written a program to this size, I'm curious if my use of variables, as well as, solutions are the most optimal way for ...