Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.
-4
votes
0answers
13 views
Why am I getting NZEC(Non zero exit code)? [on hold]
The question was on codechef(https://www.codechef.com/problems/SSWAP2)
...
6
votes
1answer
67 views
5
votes
1answer
36 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 ...
7
votes
2answers
47 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
2answers
264 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
292 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
75 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
212 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
86 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
55 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) ...
12
votes
2answers
79 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
89 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
235 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 ...
22
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
127 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
56 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
55 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
25 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
106 views
8
votes
2answers
71 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, ...
11
votes
1answer
78 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 ...
7
votes
0answers
40 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
126 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
103 views
7
votes
2answers
82 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 ...
4
votes
0answers
26 views
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
54 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
109 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 ...
6
votes
1answer
85 views
Optimizing a python script with large arrays
I have a python script that I'd like to speed up. I'm hoping some of the gurus here can offer some advice.
The script reads in some data from file: 2 arrays with lat/lon vals, 3 arrays with image ...
3
votes
1answer
37 views
Euler Project 14 - Longest Collatz Sequence in PHP
This is my solution to Project Euler 14:
The following iterative sequence is defined for the set of positive integers:
...
7
votes
2answers
70 views
XML splitting query very slow
I have a query to split a delimited string into to multiple columns. The query is extremely slow and takes more than 5 minutes to handle 80444 rows. How can I improve execution time?
...
8
votes
1answer
104 views
Simulating image transfer over noisy channel with a repetition code
I need to write a software in JAVA which allows me to simulate the transfer of some images over a noisy channel while adding redundancy with a repetition code
.
Before going into code details and ...
4
votes
0answers
34 views
5
votes
1answer
84 views
Function to convert a decimal number as a string to hexadecimal
I am designing a cipher and need to convert between bases repeatedly in a loop. I have optimized the everything else, but I'm not too familiar with C++ code, and and am trying to figure out how to ...
11
votes
4answers
465 views
Function to format the local time
This is a statement that I use a lot in my code base:
(LocalDateTime.now()).format(DateTimeFormatter.ofPattern("ssmmHHddMMMuu"))
Should I create a static method ...
1
vote
0answers
16 views
ByteBuffer Performance with Java NIO2 AsynchronousChannelGroup.withFixedThreadPool
I have a socket which will be receiving more than 100 TPS, so I need the reading to be as fast as possible. In this socket, I read the info I need to build a String and check if it matches a regex. I ...
10
votes
2answers
43 views
What a crooked way to compute the next straight string (advent of code 11)
This year I have been participating in the Advent of Code series of challenges, and it just so happened that I'd be doing them in Javascript. Not my usual weapon of choice, but I do have some ...
7
votes
2answers
71 views
Find value from other dataset based on 6 variables that must be equal in both datasets
I have two datasets that are both within a worksheet, call them Data and IBES. The code checks whether the 6 variables are the same in each dataset and then writes the value from a specific column to ...
17
votes
3answers
265 views
Synchronous / asynchronous REST client
I have working code with original design, and now I had a slight design change so trying to code review that as well. I already had code review on my original design here.
Original Design:
I am ...
5
votes
2answers
64 views
Using UPSERT to maintain word counts for subtitles
I will first explain the context. I want to read serie subtitles contained in .srt files. I have already done the part of extracting the words from the files (and how many times the word appears for a ...
7
votes
1answer
42 views
Counting the overlapping intervals in the union of two sets
I had to recently implement a code to count the union of all intervals (if there are overlapping intervals) for an interview. I was provided with the following function stub:
...
2
votes
1answer
38 views
jQuery replace text with HTML plugin
I've written a jQuery Plugin which searches text & replaces it with other text or HTML.
Now everything works quite well but recently I came across this SO question where the OP could have use of ...
4
votes
2answers
82 views
Function that produces \$a^nb^nc^n\$
I'm trying to write a function that produces an infinite list containing strings of the form \$a^nb^nc^n\$.
My first idea was to do it using comprehensions.
...
3
votes
2answers
46 views
Very slow Project Euler Q3 (largest prime factor of a large number)
My code returns the correct answer for the example (highest prime of 13195 is 29), but when I test against the number in the question my code basically is too slow for my liking.
The prime ...
9
votes
4answers
345 views
Title case a sentence function
I am new to programming. I have written a solution in two different ways, but would like to know what is considered a better solution, and why.
Additionally, in terms of performance, why would one ...
4
votes
1answer
59 views
Selecting filter checkboxes using Selenium
I am using Selenium Webdriver via Java. My method clicks on a filter check box (eg. make, model, etc.), that is passed in, from a modal.
When running my method in my test class, via ChromeDriver, it ...
3
votes
1answer
48 views
Compare dicts and record changes
My goal is to continually update an object and record any changes and the times they were made at. The input has to be JSON but the output/storage format doesn't.
This function will check a JSON ...
6
votes
1answer
86 views
Algorithm to find pair with max sum from two arrays
Algorithm to find pair with max sum from two arrays
A[0 ... n] and B[0 ... n]
A[i] + B[j] = max (A[i] + B[j], with i < j)
i,j < 99999; n < 99999
My ...