Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Truncation takes longer and longer

Abierto
#20 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
ruby
Área
databases

Línea de trabajo

Comienza reproduciendo el benchmark de tiempos repetido de DatabaseCleaner.clean_with :truncation mostrado en el issue. Inspecciona la estrategia de truncation de ActiveRecord y su comportamiento de limpieza de la base de datos para identificar por qué las ejecuciones repetidas se vuelven más lentas; se considera terminado cuando las truncaciones repetidas ya no muestran el aumento de tiempo de ejecución informado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I had noticed that my specs are getting very slow, and started investigating strategies. Apparently the more you truncate, the longer it takes. This behavior seems very strange:

irb(main):009:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t=> 1.023764
irb(main):010:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 0.793042
irb(main):011:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 0.829454
irb(main):012:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 0.870453
irb(main):013:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 0.940325
irb(main):014:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 1.03202
irb(main):015:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 2.176829
irb(main):016:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 2.466992
irb(main):017:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 2.341618
irb(main):018:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 2.4591
irb(main):019:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 3.078432
irb(main):020:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 3.056646
irb(main):021:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 3.314674
irb(main):022:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 3.514017
irb(main):023:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 3.822936
irb(main):024:0> t = Time.now; 10.times{ DatabaseCleaner.clean_with :truncation }; Time.now - t
=> 4.109673
Lenguaje dominante
Ruby
Estrellas
76
Forks
76
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DatabaseCleaner/database_cleaner-active_record

Todos los issues de DatabaseCleaner/database_cleaner-active_record

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.