Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Recent refactor results in significant performance hit

Aperta
#14 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api, performance

Direzione di ricerca

Start by running speed-test.py and speed-test-old.py, then compare the cached retrieval paths entered through pokebase.cache.set_cache and pokebase.api.set_cache. Trace the call from pokebase.pokemon('jigglypuff') and identify why the refactored cached path is slower. Done means cached retrieval returns to the earlier timing range without changing the demonstrated behavior.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I was looking at the current state of the refactor, and noticed that there's a significant performance drop off (about an order of magnitude) from the changes.

Namely, once the cache is set, retrieving a pokemon takes an order of magnitude longer (jumping from taking ~.25s to ~3s).

 ~/programming/pokebase (pre-refactor)$ time python3 speed-test-old.py 

real	0m41.041s
user	0m0.796s
sys	0m0.065s
 ~/programming/pokebase (pre-refactor)$ time python3 speed-test-old.py 

real	0m0.241s
user	0m0.217s
sys	0m0.021s
 ~/programming/pokebase (pre-refactor)$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
 ~/programming/pokebase (master)$ time python3 speed-test.py 

real	0m31.404s
user	0m1.572s
sys	0m0.546s
 ~/programming/pokebase (master)$ time python3 speed-test.py 

real	0m3.095s
user	0m0.940s
sys	0m0.482s
 ~/programming/pokebase (master)$ cat speed-test.py 
import pokebase
from pokebase.cache import set_cache

set_cache('speed-test-cache')

pokebase.pokemon('jigglypuff')
 ~/programming/pokebase (master)$ cat speed-test-old.py 
import pokebase
from pokebase.api import set_cache

set_cache('speed-test-cache-old')

pokebase.pokemon('jigglypuff')

Originally posted by @jrubinator in https://github.com/GregHilmes/pokebase/issues/10#issuecomment-414134798

Lingua principale
Python
Stelle
361
Fork
58
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PokeAPI/pokebase

Tutte le issue di PokeAPI/pokebase

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.