Open
Conversation
spajic
approved these changes
Apr 17, 2019
Owner
spajic
left a comment
There was a problem hiding this comment.
wow, мощная работа!
Не уверен, что кэширование в этом примере стоит применять.
Тут потенциально много трипов, которые легко рендерятся.
Поэтому не исключено, что найдутся значения кол-ва трипов, кол-ва посещений страниц, варианты кэширующего бэкенда, при которых кэширование скорее помешает, чем поможет.
В целом 👍
| gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] | ||
| end | ||
|
|
||
| gem 'strong_migrations', '~> 0.3.1' |
| @@ -0,0 +1,97 @@ | |||
| class EntitiesProcessing | |||
| @to = City.find_by_name!(params[:to]) | ||
| @trips = Trip.where(from: @from, to: @to).order(:start_time) | ||
| @trips = Trip. | ||
| joins(bus: :services). |
Owner
There was a problem hiding this comment.
Смущает использование joins
joins лучше использовать для фильтрации, а тут лучше бы preload или eager_load
| class EntitiesProcessing | ||
| class << self | ||
| def call(file_name:, with_gc: true) | ||
| GC.disabled unless with_gc |
|
|
||
| ActiveRecord::Base.establish_connection(config) | ||
|
|
||
| Benchmark.ips do |bench| |
| config.file_watcher = ActiveSupport::EventedFileUpdateChecker | ||
|
|
||
| config.after_initialize do | ||
| Bullet.enable = true |
| disable_ddl_transaction! | ||
|
|
||
| def change | ||
| add_index :trips, [:from_id, :to_id], algorithm: :concurrently |
|
|
||
| networks: | ||
| cources-network: | ||
| name: cources-network |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Импорт данных
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