• benchmark of some solutions

Question related to mission The Longest Palindromic

 

I pick up some user's solutions and benchmark them.

condition

total string length is 1000.

palindromic substring length 10, 100, 200, 500, 800, 1000

use timeit (number=10)

solutions

from speedy category (all three solutions)

@lezeroq first

@veky Quasilinear

@DiZ manachers-algorithm

from Uncategorized category (most voted and typical two solutions)

@Moff first

@Sim0000 first

@ciel first

from Clear category (most voted)

@Pouf straightforward

benchmark result (seconds)

length = 10

DiZ 0.025

lezeroq 0.0283

veky 0.0374

Sim0000 1.1187

ciel 3.7268

Pouf 3.8737

Moff 3.9224

length = 50

DiZ 0.0235

lezeroq 0.0282

veky 0.0366

Sim0000 1.0234

ciel 3.5604

Pouf 3.7022

Moff 3.9136

length = 100

DiZ 0.0243

lezeroq 0.0282

veky 0.0365

Sim0000 0.929

ciel 3.3636

Pouf 3.4919

Moff 3.9207

length = 200

DiZ 0.0243

lezeroq 0.0287

veky 0.0353

Sim0000 0.7416

ciel 2.9091

Pouf 3.0129

Moff 3.9104

length = 500

DiZ 0.0258

lezeroq 0.0303

veky 0.0329

Sim0000 0.2986

ciel 1.4756

Pouf 1.5125

Moff 3.9236

length = 800

DiZ 0.0267

lezeroq 0.0308

veky 0.0286

Sim0000 0.0521

ciel 0.2767

Pouf 0.2828

Moff 3.9179

length = 1000

DiZ 0.0276

lezeroq 0.0317

veky 0.0266

Sim0000 0.0

ciel 0.0

Pouf 0.0

Moff 3.915

Three solutions in speedy category are quite fast. In almost case, @DiZ is winner. Next three typical solutions use early abort strategy. Always @Moff 's solution is the slowest.

Thanks