Questions tagged [coding-efficiency]

For questions regarding programmer efficiency, not computer efficiency, e.g. tightening one's edit-compile-test loop.

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é …
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",…
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…
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…
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": , …</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/python" class="post-tag grid--cell" title="show questions tagged 'python'" rel="tag">python</a> <a href="../../questions/tagged/python-3.x" class="post-tag grid--cell" title="show questions tagged 'python-3.x'" rel="tag">python-3.x</a> <a href="../../questions/tagged/performance" class="post-tag grid--cell" title="show questions tagged 'performance'" rel="tag">performance</a> <a href="../../questions/tagged/dictionary" class="post-tag grid--cell" title="show questions tagged 'dictionary'" rel="tag">dictionary</a> <a href="../../questions/tagged/coding-efficiency" class="post-tag grid--cell" title="show questions tagged 'coding-efficiency'" rel="tag">coding-efficiency</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Nov 07 '18 at 04:36">asked Nov 07 '18 at 04:36</time> <a href="../../users/9431573/sam" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/9431573.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Sam" /> </a> <div class="s-user-card--info"> <a href="../../users/9431573/sam" class="s-user-card--link">Sam</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">641</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="7 silver badge">7</li> <li class="s-award-bling s-award-bling__bronze" title="17 bronze badge">17</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-53110553"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>3</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/53110553/improve-the-efficiency-of-my-powershell-script" class="question-hyperlink">Improve the efficiency of my PowerShell script</a></h3> <div class="excerpt">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…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/performance" class="post-tag grid--cell" title="show questions tagged 'performance'" rel="tag">performance</a> <a href="../../questions/tagged/powershell" class="post-tag grid--cell" title="show questions tagged 'powershell'" rel="tag">powershell</a> <a href="../../questions/tagged/coding-efficiency" class="post-tag grid--cell" title="show questions tagged 'coding-efficiency'" rel="tag">coding-efficiency</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Nov 01 '18 at 23:00">asked Nov 01 '18 at 23:00</time> <a href="../../users/7265172/dcraven" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/7265172.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="dcraven" /> </a> <div class="s-user-card--info"> <a href="../../users/7265172/dcraven" class="s-user-card--link">dcraven</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">139</li> <li class="s-award-bling s-award-bling__silver" title="4 silver badges">4</li> <li class="s-award-bling s-award-bling__bronze" title="16 bronze badges">16</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-50042025"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>1</strong> answer </div> </div> </div> <div class="summary"> <h3><a href="../../questions/50042025/c-array-indexof-array-item-need-the-closest-item-if-there-is-no-match" class="question-hyperlink">c# Array.IndexOf(Array,item) need the closest item if there is no match</a></h3> <div class="excerpt">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…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/c#" class="post-tag grid--cell" title="show questions tagged 'c#'" rel="tag">c#</a> <a href="../../questions/tagged/arrays" class="post-tag grid--cell" title="show questions tagged 'arrays'" rel="tag">arrays</a> <a href="../../questions/tagged/performance" class="post-tag grid--cell" title="show questions tagged 'performance'" rel="tag">performance</a> <a href="../../questions/tagged/indexof" class="post-tag grid--cell" title="show questions tagged 'indexof'" rel="tag">indexof</a> <a href="../../questions/tagged/coding-efficiency" class="post-tag grid--cell" title="show questions tagged 'coding-efficiency'" rel="tag">coding-efficiency</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Apr 26 '18 at 11:38">asked Apr 26 '18 at 11:38</time> <a href="../../users/8879898/mohamed" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/8879898.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Mohamed" /> </a> <div class="s-user-card--info"> <a href="../../users/8879898/mohamed" class="s-user-card--link">Mohamed</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">342</li> <li class="s-award-bling s-award-bling__gold" title="1 gold badge">1</li> <li class="s-award-bling s-award-bling__silver" title="2 silver badge">2</li> <li class="s-award-bling s-award-bling__bronze" title="11 bronze badge">11</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-50013255"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status "> <strong>4</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/50013255/why-do-we-need-application-pathseparator" class="question-hyperlink">Why do we need Application.PathSeparator?</a></h3> <div class="excerpt">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…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/vba" class="post-tag grid--cell" title="show questions tagged 'vba'" rel="tag">vba</a> <a href="../../questions/tagged/interop" class="post-tag grid--cell" title="show questions tagged 'interop'" rel="tag">interop</a> <a href="../../questions/tagged/ms-office" class="post-tag grid--cell" title="show questions tagged 'ms-office'" rel="tag">ms-office</a> <a href="../../questions/tagged/coding-efficiency" class="post-tag grid--cell" title="show questions tagged 'coding-efficiency'" rel="tag">coding-efficiency</a> <a href="../../questions/tagged/path-separator" class="post-tag grid--cell" title="show questions tagged 'path-separator'" rel="tag">path-separator</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Apr 25 '18 at 02:38">asked Apr 25 '18 at 02:38</time> <a href="../../users/8112776/ashleedawg" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/8112776.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="ashleedawg" /> </a> <div class="s-user-card--info"> <a href="../../users/8112776/ashleedawg" class="s-user-card--link">ashleedawg</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">20,365</li> <li class="s-award-bling s-award-bling__gold" title="9 gold badges">9</li> <li class="s-award-bling s-award-bling__silver" title="72 silver badges">72</li> <li class="s-award-bling s-award-bling__bronze" title="105 bronze badges">105</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-29054218"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>4</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/29054218/hasownproperty-returns-true-when-checked-against-parent-object-properties" class="question-hyperlink">hasOwnProperty returns true, when checked against parent object properties</a></h3> <div class="excerpt">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…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/javascript" class="post-tag grid--cell" title="show questions tagged 'javascript'" rel="tag">javascript</a> <a href="../../questions/tagged/prototypal-inheritance" class="post-tag grid--cell" title="show questions tagged 'prototypal-inheritance'" rel="tag">prototypal-inheritance</a> <a href="../../questions/tagged/hasownproperty" class="post-tag grid--cell" title="show questions tagged 'hasownproperty'" rel="tag">hasownproperty</a> <a href="../../questions/tagged/coding-efficiency" class="post-tag grid--cell" title="show questions tagged 'coding-efficiency'" rel="tag">coding-efficiency</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Mar 14 '15 at 21:07">asked Mar 14 '15 at 21:07</time> <a href="../../users/2581562/legends" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/2581562.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="Legends" /> </a> <div class="s-user-card--info"> <a href="../../users/2581562/legends" class="s-user-card--link">Legends</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">21,202</li> <li class="s-award-bling s-award-bling__gold" title="16 gold badges">16</li> <li class="s-award-bling s-award-bling__silver" title="97 silver badges">97</li> <li class="s-award-bling s-award-bling__bronze" title="123 bronze badges">123</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <div class="s-pagination--item is-selected">1</div> <a class="s-pagination--item" href="../../questions/tagged/coding-efficiency_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/coding-efficiency_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <a class="s-pagination--item" href="../../questions/tagged/coding-efficiency_page=27" rel="" title="Go to page 27">27</a> <a class="s-pagination--item" href="../../questions/tagged/coding-efficiency_page=28" rel="" title="Go to page 28">28</a> <a class="s-pagination--item" href="../../questions/tagged/coding-efficiency_page=2" rel="next" title="Go to page 2"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>