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
36 views
C# GDI+ rendering method performance
I am looking for any performance insights or better coding style for my rendering method.
...
3
votes
1answer
23 views
Google Foobar Level 3 - Lucky Triples (Find the Access Codes)
I have been working on this problem for 3 days now. I wrote a piece of java code that works perfectly on my machine testing in Eclipse, but when I put it in Foobar, it either returns "Error(400) Bad ...
0
votes
1answer
24 views
Get reputation Badge from given score
I have written code that gets the reputation badge from given score like this:
I use an if-else statement here:
...
2
votes
1answer
47 views
Partition Equal Subset Sum Challenge LeetCode
I solved this problem in LeetCode.
Given a non-empty array containing only positive integers, find if the array can
be partitioned into two subsets such that the sum of elements in both
...
2
votes
2answers
67 views
Get height for tallest possible stack of boxes
This code is meant to compute the height for the tallest stack of boxes out of a given collection of boxes. A box has width, height, and depth dimensions. The height of a stack of boxes is the sum of ...
7
votes
1answer
74 views
Math expression evaluator
It is my second attempt to make a math expression evaluator.
To evaluate an expression, I created a class that works like this:
-it removes all the blank spaces
-if brackets are present, it ...
0
votes
3answers
162 views
compute_ranks function
I've been working on optimizing such as loop unrolling, is there anything I can do to optimize this code to make it run faster/in less cycles?
...
2
votes
0answers
14 views
Complex views are a little slow
I have this view vw_RFQPartVendor that's based on these two views vw_requestVendor and ...
2
votes
2answers
170 views
Get character occurence count along with character in a string
I want to find character sequence count in a given string.
Sample Input: aaaabbbbaaacccbbb
Output: a4b4a3c3b3
My below function is working great and giving me the same result. but can this be ...
7
votes
3answers
387 views
Word Pattern challenge in LeetCode
I solved this problem from LeetCode:
Given a pattern and a string str, find if str follows the same
pattern.
Here follow means a full match, such that there is a bijection between
a letter ...
3
votes
1answer
42 views
Unique nucleotide permutations, Python itertools product
I'm searching for all the unique possible permutations of nucleotide given a defined length. By unique, I mean the reverse complement would not be counted.
ACGT
For example, permutations of length ...
3
votes
1answer
60 views
Multi threaded bottom up merge sort 3x as fast as single threaded?
Before I tried this, my impression was that (bottom up) merge sort would be memory (actual ram) bound, and not affected much by multi threading, but a 4 thread sort is about 3 times as fast as a ...
7
votes
3answers
792 views
Project Euler Problem 35: counting circular primes below 1 million
Project Euler Problem 35 asks:
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.
How many circular primes are there ...
6
votes
2answers
68 views
Generating matrix/image kernel from List
I have another question from same program where is full code, but this question focus only single process/function of that program.
My problem is performance when creating dynamic Image kernel from ...
1
vote
1answer
32 views
Modelling an account manager in OOP
I have this task of modelling a system where given a group of users each can keep track of their expenses. The basic requirements are as followed:
To be able to give credit to an user.
Find all the ...
3
votes
2answers
25 views
Largest substring which starts and ends with some substring
This code is meant to find the length of the largest substring within a string that starts and ends with a given non-empty substring. Here are some examples:
...
5
votes
2answers
68 views
Replacing consecutive equal elements in a list with a new element
In the code below I will replace all consecutive equal elements in a list with a new element. In this case I have chosen the new element to simply be the concatenation of all the equal elements, but I ...
1
vote
0answers
36 views
Word comparison in Python
I'm developing a Python script which looks up over a huge-prelexicographically sorted list of different words (such as 33.000) and the goal is to remove those words which have less than two letter ...
2
votes
0answers
31 views
Requesting information about people from a web API
I'm requesting from a web API information about 20,000 people that I need to update continuously at lightning speed (the web server doesn't throttle the number of requests). I can request an update on ...
-1
votes
0answers
26 views
Execution reach to timeout for a large number of records (90K) in Rails
I am using the records to render in view after fetching from database after modification. It is working fine for records up to 5000 but show timeout when try for 90,000 records.
I run individual ...
1
vote
0answers
24 views
SQL Procedure to populate or create tables from views - performance issues
I have written the below to populate/create tables (t_) from all of the corresponding views (v_) in my database. I converted a previous script from using a cursor to improve running speed. Is there ...
3
votes
1answer
66 views
Return path to a value in a nested object
Description:
Its not a programming challenge but I though to write a small utility which will return the path to a primitive value in a possibly nested object. The idea is not original.
Code:
...
4
votes
3answers
164 views
0
votes
0answers
38 views
Connecting to a database with ADO.NET [on hold]
We are using ADO.NET to connect to a database in all the web applications we are developing. Normally there are few people using the systems and in a new web application there are more users than ...
3
votes
1answer
55 views
Find Row Pairs that are never both 1
Given sample_size many arrays of length dim. For each index from 1 to dim, i want to give a list of indices, where no sample ...
0
votes
0answers
31 views
Extract strings from Deterministic finite automaton
I have created a class which one can build a Deterministic Finite Automaton, with different states - including a start state and one or several accepting states. Also, every transitions has at least ...
-1
votes
0answers
19 views
3
votes
2answers
54 views
Enforce execution order with collections of CompleteableFuture's
I receive a message that contains a collection of items that need to be processed.
Processing each item involves sequential calls to various services.
The services return a ...
7
votes
1answer
913 views
Base64 implementation in C#
I've written the following unsafe C# method to convert a byte array to Base64 encoding. It works, but it runs at a significantly slower rate than the built-in ...
4
votes
1answer
51 views
C++ Tic Tac Toe Game
I have reached a mini-capstone where I am asked to create a tic tac toe program. I have successfully created the program. What I'd like feedback on is two things:
1. How do I number my columns like I ...
8
votes
3answers
2k views
Really fast Knight's Tour using concurrency and Goroutines
In less that 5 seconds on a normal PC, I found the answer in simple brute-force. Before I met Go, I didn't believe that it will be so easy to use all the power of the PC by using Go Goroutines for ...
3
votes
2answers
50 views
Get subsets of a set given as a list
This code is meant to create a list of subsets of a given set which is represented as a list.
I'm doing this to improve my style and to improve my knowledge of fundamental algorithms/data structures ...
1
vote
0answers
30 views
Optimize subquery that searches xml
The following query lists all domains from multiple companies in which a value occurs in an XML set. This is filtered to the most recent occurrence within a provided date range.
On large databases ...
1
vote
2answers
49 views
Find median of list of integers
This code is meant to find the median of a list of integers. The list is assumed to be of odd length.
This is based of this HackerRank question.
I'm doing this to improve my style and to improve my ...
2
votes
1answer
42 views
Finding an arbitrary word in a string of words given an offset
Background
Given a string (s) and an offset into that string (offset), find the whole word that can be found at the given ...
1
vote
0answers
17 views
Laravel 5.3 model for mapping pages to multilingual translations
I have a Many To Many Polymorphic Relation like this:
...
6
votes
2answers
278 views
Reduce as many adjacent chars as possible in string
This code is meant to reduce a given string as much as possible by deleting adjacent characters. Here are some examples:
...
1
vote
1answer
32 views
Acquiring earnings information
The first part of the query grabs Policy's Premiums, Effective and ...
1
vote
1answer
39 views
Python program for testing the Collatz Conjecture
This is a simple program to test if integers will follow an interesting, improvable statement that if disproven, calls for a bravo.
But, ignoring the pretentious poetry, this code allows the user to ...
4
votes
1answer
218 views
Converting HEX values to Unicode characters
I have a small bot for social network, which accepts message "unicode XXXX XXXX XXXX ...", where XXXX - HEX values which I ...
6
votes
5answers
271 views
Another DataGrid (ObservableCollection) Filtering Method
I have re-written my DataGrid filtering method to try to improve performance and I feel that although this is the fastest yet, there is still room for improvement ...
2
votes
0answers
41 views
Computing the weighted centroid dependent on previous row/column
I am working on a project for a Raspberry Pi that requires some image processing.
The aim is to find a white line on a black background by finding the weighted mean in each row/column. However to ...
9
votes
2answers
350 views
Who are these lurkers?
Last night in The 2nd Monitor there was a discussion about postless users - I wanted to see how many there are, whether they're one-timers that showed up once, registered and never came back, and ...
0
votes
0answers
17 views
Updates values in master table based on conditions, then refreshes pivot table
There is significant screen updating going on with my code when I run it. The macro is being ran from a button where the textbox is. "JobCol_Master" is a sub-range of a column in the master table on ...
0
votes
0answers
19 views
UDFs with Header-Case selection is too slow
I am working at a project where we implemented 10 different UDFs which gave us high flexibility and a clean code but basically screwed the file up as the file got super slow in the end: The problem is,...
0
votes
1answer
78 views
Calculating the difference between 2 arrays
I made this function to calculate the difference between 2 arrays and return it in a third array. I'm using this function as a part of stocktaking functionality I apply in my accounting system.
...
3
votes
1answer
35 views
Bot-like Spring Java service for checking advertisements
I am in the middle of developing a Spring Boot application, which has a service acting like a bot.
advertisementService.update(Advertisement ad) is a method which ...
3
votes
4answers
95 views
Optimizing algorithm of analyzing incoming data
I've been making an app, which gets data from external device (via bluetooth) and displays received data.
I'm still pretty new to programming and I'm struggling to finish this app.
I wrote some code, ...
4
votes
1answer
98 views
Efficiently creating a list of formatted hex values
My background is in C, and I'm finally learning this new-fangled "Python" that all the cool kids are talking about.
I want to create a list of formatted hexadecimal values like so:
...
3
votes
1answer
34 views
Loads two columns from excel - cleans up the data - and makes a new list of unmatched values
I am comparing two columns of data (~20k rows) to find the items that do not match. Actually one of my files is an export from an Oracle database, but I have not gotten to the point of working with ...