How fast is my solution

The percentile beside an accepted submission, the growth analysis that runs it at four input sizes, and why neither of them ever prints a Big-O.

View as .md

Once a submission is accepted, two different things can tell you something about its speed. Both are measurements. Neither is an analysis of your code, and that distinction is the whole design.

The percentile#

Beside an accepted submission you may see how its runtime compares with other accepted submissions on the same problem.

Two rules make that number worth reading:

  • It is always within one language. Java against Java, C++ against C++. Comparing across languages would tell every Java user they are slow forever for writing correct code.
  • It is hidden until there is enough to compare against. "Beats 100% of submissions" when yours is the only one is a joke, and it costs trust in every other number on the page.

So a missing percentile on a new problem is expected.

Analyse my solution#

The second one is opt-in. On an accepted submission you may find an Analyse my solution button. It runs your accepted code again at four increasing input sizes, times each, and reports what happened to the clock.

You get the four sizes, the four times, and a sentence:

Your solution's runtime roughly quadrupled when the input doubled.

That sentence is true, it is falsifiable against the numbers printed beside it, and it teaches the idea better than a symbol does.

What the answers can be#

ResultWhat was observed
Flat / SublinearTime barely moved as the input grew.
LinearDoubling the input roughly doubled the time.
IndistinguishableBetween linear and n log n - at these sizes they differ by less than the noise, so we say so rather than pick one.
QuadraticDoubling the input roughly quadrupled the time.
Cubic or worseIt grew faster than quadratically.
Too fast to measureEvery size finished so quickly that the timings are mostly overhead. Not a verdict on your solution - the measurement could not see it.
Not enough dataToo few sizes completed to fit anything.

When the button is not there#

It is absent rather than disabled when the problem cannot be profiled. Measuring needs an input generator written by the problem's author in your language, and most problems will not have one for a long time. Rather than offer a button that spends a sandbox slot to produce a failure, we do not draw it.

It is also only offered on accepted submissions. Profiling a wrong answer measures how fast it is wrong.

It measures once#

A finished analysis is stored and shown again without re-running anything. Your source has not changed, so re-measuring would spend a run to produce the same number plus the noise of a shared machine - and would show you two different slopes on two visits, which teaches that the measurement is arbitrary.

If the problem's test cases change afterwards, the stored analysis is marked stale.

Was this page helpful?

Last checked against the product on . Behaviour changes are listed in the changelog.