Skip to main content
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
Search options not deleted user 26190

Performance is a subset of Optimization: performance is the goal when you want the execution time of your program or routine to be optimal.

4 votes

Simple matrix class - version 2

Most likely the performance degradation is caused because in your previous version, operator<< took a Grid3d&, and in this version it takes a Grid3d. … Grid3d(const Grid3d &other) : L(other.L), M(other.M), N(other.N) { buffer = new double[L * M * N]; std::memcpy(buffer, other.buffer, M * N * L * sizeof(double)); } memcpy may give you better performance
ruds's user avatar
  • 3,321
3 votes

Binary Search in C - Optimization

If your average case is that the looked-for element is distributed uniformly randomly (and that your array is pulled from the same distribution), you actually gain in the average case by not returning …
ruds's user avatar
  • 3,321
5 votes

Greatest prime number smaller than N where N can be as large as 10^18

I wouldn't be surprised to see a 10-33% performance improvement from that change alone. … Here, each vector is created exactly once per invocation of your program (NOTE: as with all performance-related issues, PROFILE BOTH VERSIONS. …
ruds's user avatar
  • 3,321
7 votes

Fast Risk Battle Simulator

If you can get an all-base-Python solution (no numpy) with fast random numbers, or generate large batches of random numbers at once, you may get a performance boost. …
ruds's user avatar
  • 3,321
1 vote

Efficiency of vector like class

First of all, I suggest using a pre-rolled benchmarking library. Microbenchmarking is very difficult to get right. Try something like google/benchmark. Your method of measurement is very noisy. It wou …
ruds's user avatar
  • 3,321
4 votes

DFS-based exhaustive word grid search

This is fairly tight; I don't think there's much more performance to pull out without dropping into C. …
ruds's user avatar
  • 3,321
3 votes

Performance of modular square root

I'm not really sure I understand your code; it's not really organized in a way that aids readability. Use functions, so that I don't need to spend a minute or more reading the first few lines of the p …
ruds's user avatar
  • 3,321
2 votes

Project Euler # 74 Digit factorial chains in Python

A few comments. First, your algorithm for computing the length of a chain is quadratic, because you convert your list to a set at each iteration. Second, there's a lot going on in get_factorial_seque …
ruds's user avatar
  • 3,321