Skip to content

Task-4#9

Open
one0fnine wants to merge 1 commit intospajic:masterfrom
one0fnine:master
Open

Task-4#9
one0fnine wants to merge 1 commit intospajic:masterfrom
one0fnine:master

Conversation

@one0fnine
Copy link

Импорт данных

Warming up --------------------------------------
SM Process 1.000 i/100ms
MD Process 1.000 i/100ms
LG Process 1.000 i/100ms
Calculating -------------------------------------
SM Process 0.312 (± 0.0%) i/s - 2.000 in 6.419945s
MD Process 0.082 (± 0.0%) i/s - 1.000 in 12.197217s
LG Process 0.053 (± 0.0%) i/s - 1.000 in 18.754937s

Comparison:
SM Process: 0.3 i/s
MD Process: 0.1 i/s - 3.80x slower
LG Process: 0.1 i/s - 5.84x slower

Отображение данных

Concurrency Level: 5
Time taken for tests: 6.239 seconds
Complete requests: 10
Failed requests: 0
Total transferred: 74418 bytes
HTML transferred: 67230 bytes
Requests per second: 1.60 [#/sec] (mean)
Time per request: 3119.669 [ms] (mean)
Time per request: 623.934 [ms] (mean, across all concurrent requests)
Transfer rate: 11.65 [Kbytes/sec] received

Copy link
Owner

@spajic spajic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, мощная работа!

Не уверен, что кэширование в этом примере стоит применять.
Тут потенциально много трипов, которые легко рендерятся.
Поэтому не исключено, что найдутся значения кол-ва трипов, кол-ва посещений страниц, варианты кэширующего бэкенда, при которых кэширование скорее помешает, чем поможет.

В целом 👍

gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

gem 'strong_migrations', '~> 0.3.1'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -0,0 +1,97 @@
class EntitiesProcessing
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 плюсик за сервис

@to = City.find_by_name!(params[:to])
@trips = Trip.where(from: @from, to: @to).order(:start_time)
@trips = Trip.
joins(bus: :services).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Смущает использование joins
joins лучше использовать для фильтрации, а тут лучше бы preload или eager_load

class EntitiesProcessing
class << self
def call(file_name:, with_gc: true)
GC.disabled unless with_gc
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опечатка GC.disable?


ActiveRecord::Base.establish_connection(config)

Benchmark.ips do |bench|
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

config.after_initialize do
Bullet.enable = true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

disable_ddl_transaction!

def change
add_index :trips, [:from_id, :to_id], algorithm: :concurrently
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Плюсик за concurrently


networks:
cources-network:
name: cources-network
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опечатка courses?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants