5 votes
Accepted

Multithread execution times are slow on Ubuntu and fast on Windows

Use C++'s random number generators instead of rand() Not only is this good advice in general, it's actually the main source of your performance problems. You use <...
G. Sliepen's user avatar
  • 55.6k
4 votes

Optimal Solution for the Four Divisors Problem on LeetCode

nested function Thank you for breaking out a Helper. def sumFourDivisors(... ... def sumFourDivisors_aux(n): I will offer my usual advice: Make ...
J_H's user avatar
  • 25.5k
3 votes

Looking for feedback on a flavour of Radix tree I wrote. This is version 2 of the class original posted on this forum

That's a lot of code! This kind of large code review whould probably include tests to prove that it is working correctly. The complexity here is large enough that I can not spot that kind of thing ...
Martin York's user avatar
  • 95.1k
3 votes

Optimal Solution for the Four Divisors Problem on LeetCode

We could move the test for divisibility by 4 before the more expensive square-root operation. Note also that we have a specific code path for number 8, so we could hard-code a return there: ...
Toby Speight's user avatar
  • 75.1k
2 votes

Optimal Solution for the Four Divisors Problem on LeetCode

I found it odd (pardon the pun) that your “divisible by 4” check is before your “divisible by 2” check. You only need to check if the number is divisible by 4 if it is divisible by 2, which is ...
AJNeufeld's user avatar
  • 33.5k
2 votes

Json4 parser in Typescript - Optimized

Improving Performance for TypeScript JSON Parser When seeking performance enhancements for your JSON parser, it's crucial to identify bottlenecks and optimize strategically. Here are a few suggestions ...
Łukasz D. Tulikowski's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible