Tagged Questions
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
0answers
12 views
Data formatting using string spanning
I would like to know how to make my code better. I'm still a newbie in Android, so any tips are appreciated.
The code is an AsyncTask class extender that formats data into a nice looking Spannable ...
2
votes
1answer
25 views
Restaurant booking subquery
I have two database table name called "tablestr table" and "restbookingtable":
tablestr:
restbooking:
I want to retrieve bookingsection_id from the booking ...
2
votes
3answers
55 views
Algorithm to follow a point
This code basically makes the dot follow a certain point on the screen. It consumes a significant amount of computing time in my game, so I'd like it to be best ...
2
votes
1answer
36 views
Removing accents from certain characters
I have a method that I am using to remove accents from certain characters. The problem is the massive slew of characters I am expected to work with. I have to, basically, remove accents from all Latin ...
3
votes
1answer
30 views
Simple audio playback system
I am trying to optimize my game written in Java and I used the VisualVM launcher for profiling and monitoring my game. What caught me by surprise was that my basic utility to play sound effects was ...
3
votes
0answers
45 views
Creating and combining rectangles based on a result of an edge detection
Context
In an imageprocessing project of mine, I needed to do some edge detection and implemented the Theo Pavlidis algorithm which works quite well. A problem had been to get the next "good" ...
6
votes
1answer
41 views
Spell Checker in C
I recently stumbled across this article on how to write a spelling corrector, and figured I'd try to have a go at it in C (mainly because the link at the end of the page for the C code is broken).
...
1
vote
1answer
90 views
Finding the first non-repeating character in a string
Below is a problem I encountered during an online course. There are a lot of similar questions asked on this, but I couldn't find a solution there as well as I believe my specific issue is a bit ...
4
votes
2answers
41 views
Wildcard string search with capture
My goal was to create a function as performant as possible with results being:
True/False as to whether wild matches str.
...
1
vote
0answers
21 views
INTEST on Codechef in Python 3
I have written a program in Python 3 for the INTEST problem on Codechef (included in question). The program is taking a lot of time (55.76s) in Python 3. The same code takes almost 1/10 of the time ...
1
vote
0answers
21 views
Counting unordered factorizations with distinct parts
Trying to solve this combinatorics problem, I wrote some functions to count the number of unordered distinct factorizations of an integer n into ...
1
vote
0answers
21 views
Counting Neighbors (Why scipy.signal.convolve2D so fast?)
Here is my Python implementation of counting neighbours of Game of Life with radius as parameter.
...
2
votes
2answers
49 views
5
votes
2answers
37 views
Return a rank for string of letters based on alphabetical permutations
So, first off, a little bit of unrelated information: I am preparing for a technical interview. I was reading this article, How to Prepare for (and Ace) the Technical Interview, by Rich Hein and I ...
5
votes
3answers
314 views
Login for desktop application
I am building a login using an API call to a URL that returns JSON data. The login works and is functional but in terms of "correctness" and "professionalism", I am looking to get input from some of ...
7
votes
4answers
148 views
Looks at order data and arranges it to focus on order locations
I have a sheet that order a bunch of information on individual orders. Order numbers are in column A, other information is in columns B-P, and then product numbers are the headers for columns Q-DL. ...
11
votes
2answers
150 views
+200
General Game Loop 3.0
Follow up from General Game Loop 2.0
It has been quite a while. Some major changes involve:
Removed dependancy on Swing. The more I read up on Swing, the more I understood it was meant for handling ...
4
votes
1answer
60 views
System.Drawing.Bitmap Wrapper Class
I have created two classes to help me work with images in C#. I decided to wrap the System.Drawing.Bitmap so I don't have to deal with different file formats (let ...
0
votes
0answers
11 views
Optimize groovy DAO
I have a DocDao which is configured with the docDataSource as below
docDataSource configuration from applicationContext.xml
...
4
votes
7answers
1k views
Primes Without 1's
Requirement primes numbers which do not have digit 1 in it.
Input
The first line contains T, the number of test cases. Followed by T
lines each contain two numbers M and N
Output
...
8
votes
1answer
61 views
Top wiki pages as an app
I recently did an interview task. I was rejected because of bad code quality. There was two tasks. Here I will present the first, second will be posted in time.
This project is avalible on GitHub
...
2
votes
1answer
38 views
Logging and profiling - automatic logging through annotations
I am working with a little project intended to allow applications to benefit from aspect oriented programming. The first aspect is logging, which is already working. However I want this code to be ...
4
votes
1answer
51 views
First index of number in the arithmetic progression (which is multiple of prime)
Things to deal with this problem.
An infinite Arithmetic progression.
A prime number. - p.
The starting number of an Arithmetic Progression. - a.
Common difference in the arithmetic ...
5
votes
0answers
85 views
Backpropagating with Neural Network
I wrote a Java program implementing a neural network with backpropagation. For anyone who isn't familiar with Neural Networks and Backpropagation, here is a good resource. Here is another ...
4
votes
2answers
148 views
“Lights off” puzzle
Lights Off is a puzzle game consisting of an \$n\times n\$ grid of lights. At the beginning of the game, some of the lights are switched on. When a light is activated, it and its four neighbors in the ...
4
votes
1answer
30 views
Adding hostname to block list after x consecutive failures in multithreading application
I am using Callable in my code which will be called by multiple threads as shown below. Given a user id in DataKey object, I will find out what are the ...
2
votes
1answer
60 views
Looking for identical files (or directories) in a filesystem
Dilemma
The code below is in its infancy, but for now is an effort to crawl my entire file system and find duplicates whilst adhering to a variety of exclusion criteria. My current strategy for ...
6
votes
0answers
54 views
Rust Brainfuck interpreter
I took the code from kostyas benchmarks for the Rust Brainfuck interpreter and tried to optimize it. There is also a discussion on Reddit about the poor performance of Rust in the Benchmark.
Before ...
2
votes
3answers
64 views
HackersEarth - Reverse primes
Generate as many distinct primes P such that reverse (P) is also prime
and is not equal to P.
Output: Print per line one integer( ≤ 10^15 ). Don't print more than
10^6 integers in all.
...
12
votes
3answers
942 views
Java and C++ stack implementations with dramatically different performance
I'm developing a small programming language for use in any project I have where I feel a small scripting language could be used well. I've written two emulators for the language, one in C++ and one in ...
1
vote
0answers
16 views
Google Drive Folders caching to file
I have the recursive funtion below to cache all the folders of my company Drive into a file, it works like a charm but takes too long, >30 secs to read and save the 300 folders.
What I need is to ...
0
votes
0answers
25 views
Obtaining only the values that are inside an interval given a list [closed]
I'm trying to add the element a into a list A in the case that there is only one value b in the list B that is inside the interval [a * 0.999999 , a * 1.000001]. I have around 180.000 values to treat ...
5
votes
2answers
194 views
1
vote
1answer
34 views
Determine what hazard type does the building belong using GeoDjango Intersects
Below is my query to identify what hazard type does the buildings belong:
...
7
votes
1answer
58 views
Improving Terrain Generation Time in C#
I am working on making my code run smoother, since I will be using it a lot in a game in development, but I am stumped. Is there any way I could make this run faster? Improvements to the terrain ...
4
votes
1answer
63 views
Reading a text file API 15+
Is there a faster, more efficient way to read a text file than this implementation?
Taking into account phones capabilities:
...
5
votes
1answer
59 views
Saturated arithmetic
For project Euler, I need quite often to test things like is x*y*z < 1e18. Since BigInteger is usually too slow, ...
1
vote
2answers
42 views
Checking a numeric palindrome
Given A and B, count the numbers N such that A ≤ N ≤ B and N is a
palindrome.
Input:
First line contains T, the number of testcases. Each testcase consists
of two integers A and B in ...
2
votes
1answer
49 views
Reading the bytes of a PDF
I'm quite a newbie in Python and I want to speed up this method since it takes very long time especially when the size of the input file in Mbs. Also, I couldn't figure out how to use Cython in the ...
6
votes
3answers
120 views
Conditionally copy columns
I have this Excel/VBA code and here is what it does:
I have 3 sheets, where first sheet has two columns that will be used (A,C).
2nd Sheet is just the raw data file that will be imported from ...
4
votes
1answer
48 views
Sorting a list of names by greatest lexicographical order
This is a puzzle I found online that I have been trying to optimize and make the best version. The instructions for the puzzle are given below followed by my solution to the puzzle. I've tested it and ...
2
votes
2answers
57 views
Performance of unpack()
I wrote a PHP class in Zephir to increase performance, but it is still very slow and memory consuming. To compare, I wrote several variants of the same code, but ...
2
votes
1answer
38 views
Yellow Pages Search
I've written code in Free Pascal based on a contest problem (The contest insists that I have to write with Pascal). It works like charm, but I think it still need some improvements, from memory usage ...
7
votes
1answer
69 views
Finding and pasting images into a specific cell
The below macro finds and pastes images into column A. While the macro works, it starts to slow down when running 500+ images. I am not too familiar with the VBA language, does anyone have any ...
2
votes
2answers
53 views
Pathfinding in turn-based strategy game
I am using Python with libtcodpy to build a turn-based strategy game.
In this game each unit has a maximum range which varies from 4-10. This range determines how many "steps" the unit can take and ...
4
votes
4answers
109 views
Find Kth largest element in an array
I am preparing for interviews where my code would be judged based on optimizations, OOP concepts, code readability as well as my knowledge of JAVA and design patterns.
What comments will you give in ...
5
votes
2answers
59 views
Mandelbrot image generator 2.0
I have rewritten my C Mandelbrot set image generator, including many suggestions given in my previous question (see: Mandelbrot image generator), as well as some recomendations by a friend.
The total ...
2
votes
1answer
52 views
7
votes
2answers
79 views
Finding the maximum pairwise difference in a collection of colors
Note that this problem is equivalent to finding the longest line segment defined by any two points in a collection of 3D coordinates, which may be an easier way to visualize the problem, and is almost ...
1
vote
0answers
29 views
Query against history table
I have this linq query that queries a table that retains any change history done to any of the tables is constructed like this:
...