For questions regarding programmer efficiency, not computer efficiency, e.g. tightening one's edit-compile-test loop.
Questions tagged [coding-efficiency]
413 questions
20
votes
2 answers
Why does exponentiation (e.g., 10^6) take 4 times longer than calculator notation (e.g., 1e6) in R?
Using the scientific notation 10^6 in an R code (as I customarily do) results in a significantly longer computing time than using the calculator representation 1e6:
> system.time(for (t in 1:1e7) x=10^6)
utilisateur système écoulé
…

Xi'an ні війні
- 852
- 17
- 44
10
votes
4 answers
Speeding up the Erlang Edit, Compile, Run/Debug cycle
What is the fastest way to edit an Erlang application, compile the code and see the running result? Preferably jumping in the Erlang shell on the last step.
My current newbie setup:
A script that compiles the app and starts up the erl shell.
Then…

Ward Bekker
- 6,316
- 9
- 38
- 61
9
votes
6 answers
What is the most efficient approach to compose a string of length N where random characters are selected from a-f, 0-9
The requirement is to determine the most efficient approach to render a string, for example, "#1a2b3c", where "1a2b3c" are randomly selected from the set
"abcdef0123456789"
or
["a", "b", "c", "d", "e", "f", "0", "1", "2", "3", "4", "5", "6", "7",…

guest271314
- 1
- 15
- 104
- 177
9
votes
4 answers
Find if vector contains pair with second element equal to X
I have this vector:
using namespace std;
vector< pair > vec = {};
And I want to find out if exists a pair with b == X.
I know about std::find from but don't know how to apply it here.
Should I write my own…

valentin
- 2,596
- 6
- 28
- 48
8
votes
2 answers
Most efficient Android app development workflow?
Currently I'm developing my first app, and I'm noticing certain workflow patterns that are emerging. Specifically, android apps follow a kind of tree-like user activity flow, where every user action usually either proceeds down into a deeper branch…
user5132647
7
votes
2 answers
Why is it so much slower to delete objects in AWS S3 than it is to create them?
I have an AWS lambda function that watches an S3 bucket. When an image is uploaded to the bucket the lambda function creates a thumbnail of the image. However I made a mistake in the function and saved the transformed file in the same directory that…

andydavies
- 3,081
- 4
- 29
- 35
5
votes
2 answers
C++ Adjacency List Representation of Graphs
What is an efficient way to implement Adjacency List Representation of Graph in C++?
vector *edges;
list *edges;
map *edges;
map> edges;
In my opinion, it should be option 3 or 4, but I could not find any cons in using…

Smile001
- 147
- 3
- 9
4
votes
1 answer
How can I generate prime palindromes in a given range without complete searching it and using a check function?
I have seen previous solutions to this problem, but it is all complete search with a check function and not fast enough for me.
I am working on a C++ program trying to generate all prime palindromes highly efficiently in a given range of integers.…

Hudson
- 312
- 2
- 18
4
votes
4 answers
Which USB read pattern is more efficient: Multiple reads or one big read?
Which one is more efficient (= fastest) implementation for transferring data through USB and writing it on memory for further processes:
reading a little data from USB and write on memory repeatedly multiple times.
reading one huge data from USB…

Mojtaba Ahmadi
- 1,044
- 19
- 38
4
votes
1 answer
Solving logical expressions in Java with minimum iterations
I'm working on solving the logical expressions in Java comprising of AND, OR, and NOT operators.
The program has to output if the input was TRUE for any Boolean values of the variables included. I've done it successfully but it is not efficient…

DICOTA
- 43
- 4
4
votes
2 answers
Fastest way to handle nested dictionaries
I'm new to python and I'm trying to learn the best ways to write very fast code. I'm working on an exercise of handling nested dictionaries, and here is the dictionary that I'm working with:
{
"key_1": [
{
"title": ,
…

Sam
- 641
- 1
- 7
- 17
4
votes
3 answers
Improve the efficiency of my PowerShell script
The below code searches 400+ numbers from a list.txt file to see if it exists within any files within the folder path specified.
The script is very slow and has yet to complete as it did not complete after 25 minutes of running. The folder we are…

dcraven
- 139
- 4
- 16
4
votes
1 answer
c# Array.IndexOf(Array,item) need the closest item if there is no match
Here is method receive tow arrays as parameters ,
scores arrays(in descending order.) which contain duplicated values , I deleted the duplicate and
stored it in a new array without duplicate,
second array contain special player scores.
I need to…

Mohamed
- 342
- 1
- 2
- 11
4
votes
4 answers
Why do we need Application.PathSeparator?
MS Office VBA has a property called Application.PathSeparator.
I'm supportive of interoperability, but Office runs only on Windows & MacOS, and both platforms use the same \ path separator.
When would it ever be advisable to use…

ashleedawg
- 20,365
- 9
- 72
- 105
4
votes
2 answers
hasOwnProperty returns true, when checked against parent object properties
My JavaScript code:
console.clear();
function BaseClass(nname) {
var name = nname;
this.bc_PublicProperty = "DefaultValue_BaseClass";
this.bc_getName = function GetName() {
return name;
};
this.bc_setName = function…

Legends
- 21,202
- 16
- 97
- 123