Search Results
| Search type | Search syntax |
|---|---|
| Tags | [tag] |
| Exact | "words here" |
| Author |
user:1234 user:me (yours) |
| Score |
score:3 (3+) score:0 (none) |
| Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
| Views | views:250 |
| Code | code:"if (foo != bar)" |
| Sections |
title:apples body:"apples oranges" |
| URL | url:"*.example.com" |
| Saves | in:saves |
| Status |
closed:yes duplicate:no migrated:no wiki:no |
| Types |
is:question is:answer |
| Exclude |
-[tag] -apples |
| For more details on advanced search visit our help page | |
Results tagged with performance
Search options not deleted
user 716
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
Triangle of numbers maximum path - Greedy algorithm Python
General suggestions:
black can automatically format your code to be more idiomatic.
isort can group and sort your imports automatically.
flake8 with a strict complexity limit will give you more hint …
3
votes
Accepted
Simple dynamic tree in Python
Specific suggestions:
It is idiomatic to wrap the stuff after if __name__ == "__main__": in a main function.
Rather than the generic data I would suggest figuring out exactly which information you w …
4
votes
Processing an input image using probability
I'm not familiar with the algorithm, so I can't say whether there is a radically different approach which will improve performance. … This sort of performance problem really should be profiled, but without the full context and realistic images it would amount to nothing more than guesses. …
1
vote
Best way to split array to two sub-arrays, with maximum absolute difference between them
Some ideas:
You can replace sumArray with IntStream.of(a).sum();.
Tests should be written using JUnit or another testing framework and named according to what they are testing.
Try to write the abso …
13
votes
Accepted
Primes and SemiPrimes in Binary
Some suggestions related to review performance:
This code is really hard to read. … Performance-related suggestions:
It looks like mexp is only set once, but pow(2,mexp) is calculated in a bunch of places. This can be calculated once outside both loops. …
3
votes
Accepted
Display git commit statistics in bash
Some suggestions:
shellcheck should give you a few suggestions. I won't mention things I expect it to find.
Uppercase names are by convention only used for exported variables.
SUBDIRECTORY_OK is unu …
3
votes
Accepted
Simplex method (linear programming) implementation
Some suggestions:
Basically, wherever you have a comment you should consider renaming or encapsulating to avoid the need for that comment. For example:
Rename A to something like constraint_matrix …
1
vote
Changing algorithm to avoid looping with iterrows
Some general ideas:
Make sure to use descriptive names. I have basically no idea what anything in the file does or contains except index and row. And new_list doesn't tell anybody anything. What doe …
2
votes
Refactoring nested for-loops in Python
Some options:
Rather that using
for foo in bar:
if something:
process foo
you can flip the condition around and terminate early:
for foo in bar:
if not something:
continu …
3
votes
Accepted
Checking hash and passwords with a wordlist, more efficient
Some suggestions:
Run the code through at least one linter such as flake8 or pycodestyle to produce more idiomatic code.
Don't read all the lines into a variable before starting processing - this wi …
11
votes
Python program for fibonacci sequence using a recursive function
Some ideas:
A recursive solution is only as efficient as the equivalent iterative solution if the compiler/interpreter is smart enough to unroll it into an iterative solution. I'd love to be correct …
3
votes
Accepted
All-Python implementation of n-dimensional convolution
Specific suggestions:
All t abbr mks th c hard 2 rd. Plz repl abbrs w/full wrds. Think of variable names as comments – they don't matter at all to the computer, but they do matter to anybody reading …
4
votes
Accepted
Is it worth to compromise on speed to follow PEP 8 guidelines?
A reasonable question to ask, maybe not for a single instance but if you end up with extremely performance-sensitive code. …
4
votes
Accepted
Handling errors in potentially incomplete responses
Some suggestions:
Don't use exceptions for flow control unless you have to for TOCTOU or other reasons. "Tell, don't ask" is a useful guideline when requesting something from a piece of state the cur …
2
votes
Python 3 multi-threaded pinger
Some suggestions:
IP addresses are only formatted as octets (0-255) for human readability - they actually just represent integers. Instead of for example 127.0.0.1 you can use 2130706433 (127*2^24+1 …