Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8730d64
Add ignore
VidgarVii Aug 4, 2019
5e25d9d
Add rspec for task
VidgarVii Aug 4, 2019
ea03f90
Add case studies
VidgarVii Aug 4, 2019
eb5b816
Add scripts for benchmark
VidgarVii Aug 4, 2019
cdb383a
Update case study and add task-1
VidgarVii Aug 4, 2019
5079fe2
Rename task
VidgarVii Aug 4, 2019
4c70a13
Update gitignore
VidgarVii Aug 4, 2019
b09aaa6
Add description
VidgarVii Aug 4, 2019
565ee39
Add gems to Gemfile
VidgarVii Aug 4, 2019
c783fb0
Add memory prifiles
VidgarVii Aug 4, 2019
6532565
Add comments for test task
VidgarVii Aug 4, 2019
d02ec7d
Fix memory_profiler
VidgarVii Aug 4, 2019
9dc3bd6
Add profiles from ruby-prof
VidgarVii Aug 4, 2019
266230c
Refact task
VidgarVii Aug 5, 2019
bfee711
Add reports
VidgarVii Aug 6, 2019
4c632da
Refact task
VidgarVii Aug 6, 2019
b63a7a6
Stap-1/ Update task. Add frozen literal
VidgarVii Aug 6, 2019
22c11f0
Update task.
VidgarVii Aug 6, 2019
ea2a612
Refact task-2
VidgarVii Aug 7, 2019
9041e6e
Refact task-2
VidgarVii Aug 7, 2019
8bc3b8b
Refact task-2. 330Kb
VidgarVii Aug 7, 2019
640e391
Found point with stackprof
VidgarVii Aug 7, 2019
f436092
Add description to case
VidgarVii Aug 7, 2019
38aa46a
Add bench (stackprof)
VidgarVii Aug 7, 2019
46bbc48
WIP regexp slowly
VidgarVii Aug 7, 2019
5eb9f30
Update task. Regexp
VidgarVii Aug 8, 2019
31e023d
Revert task-2
VidgarVii Aug 8, 2019
e3f6276
Update reports
VidgarVii Aug 8, 2019
3bd43b1
Update task. -1 allocated
VidgarVii Aug 8, 2019
7852c7f
Update task. Reduce count retained
VidgarVii Aug 8, 2019
f08a572
Update date
VidgarVii Aug 8, 2019
f5756ea
Update task. Remove @ 25.19Kb
VidgarVii Aug 8, 2019
aeff749
Merge pull request #1 from VidgarVii/task-2-optimaiz-ram
VidgarVii Aug 9, 2019
48f52d9
Add case description. Result 959Mb with big file
VidgarVii Aug 9, 2019
5779f6b
Add report to case file
VidgarVii Aug 9, 2019
a1bc01a
Add reports with stackprof
VidgarVii Aug 9, 2019
0f27767
Add reports from ruby-prof
VidgarVii Aug 9, 2019
2e68033
Add gem oj
VidgarVii Aug 10, 2019
6948cf4
Add #save_interim_report to task-2
VidgarVii Aug 10, 2019
bbe2023
Update gitignore
VidgarVii Aug 10, 2019
841c0ac
Update task-2 16Mb
VidgarVii Aug 11, 2019
493eeb9
Add case description
VidgarVii Aug 11, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data_large.txt
.idea
result.json*
.result.tmp
benchmarks/**/result*
result_large.json
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.3'

gem 'memory_profiler'
gem 'rspec'
gem 'multi_json'
gem 'benchmark-ips'
gem 'ruby-prof'
gem 'rspec-benchmark'
gem 'stackprof'
gem 'oj'
50 changes: 50 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
GEM
remote: https://rubygems.org/
specs:
benchmark-ips (2.7.2)
benchmark-malloc (0.1.0)
benchmark-perf (0.5.0)
benchmark-trend (0.3.0)
diff-lcs (1.3)
memory_profiler (0.9.14)
multi_json (1.13.1)
oj (3.8.1)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-benchmark (0.5.0)
benchmark-malloc (~> 0.1.0)
benchmark-perf (~> 0.5.0)
benchmark-trend (~> 0.3.0)
rspec (>= 3.0.0, < 4.0.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.2)
ruby-prof (1.0.0)
stackprof (0.2.12)

PLATFORMS
ruby

DEPENDENCIES
benchmark-ips
memory_profiler
multi_json
oj
rspec
rspec-benchmark
ruby-prof
stackprof

RUBY VERSION
ruby 2.6.3p62

BUNDLED WITH
1.17.3
15 changes: 15 additions & 0 deletions benchmarks/CPU/benchmark-ips.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'benchmark/ips'
require_relative '../../task-2'

Benchmark.ips do |x|
# The default is :stats => :sd, which doesn't have a configurable confidence
# confidence is 95% by default, so it can be omitted
x.config(
stats: :bootstrap,
confidence: 95,
)

x.report("work") do
work('../data.txt')
end
end
9 changes: 9 additions & 0 deletions benchmarks/CPU/benchmark.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'benchmark'

require_relative '../../task-2'

time = Benchmark.realtime do |x|
work('data_large.txt')
end

puts "Finish in #{time}"
330 changes: 330 additions & 0 deletions benchmarks/CPU/flat.txt

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions benchmarks/CPU/ruby-prof-flat.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'ruby-prof'
require_relative '../../task-2'

RubyProf.measure_mode = RubyProf::WALL_TIME

result = RubyProf.profile do
GC.disable
work('../../data.txt')
end

printer = RubyProf::FlatPrinter.new(result)
printer.print(File.open("flat.txt", "w+"))
Binary file added benchmarks/RAM/diagram.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions benchmarks/RAM/memory_profiler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'memory_profiler'
require_relative '../../task-2'

MemoryProfiler.report do
work('../../data_large.txt')
end.pretty_print(to_file: 'reports/memory_profiler.txt', scale_bytes: true)
1,257 changes: 1,257 additions & 0 deletions benchmarks/RAM/reports/flamegraph

Large diffs are not rendered by default.

330 changes: 330 additions & 0 deletions benchmarks/RAM/reports/flat-10.txt

Large diffs are not rendered by default.

330 changes: 330 additions & 0 deletions benchmarks/RAM/reports/flat-100.txt

Large diffs are not rendered by default.

329 changes: 329 additions & 0 deletions benchmarks/RAM/reports/flat-100000.txt

Large diffs are not rendered by default.

307 changes: 307 additions & 0 deletions benchmarks/RAM/reports/flat-20.txt

Large diffs are not rendered by default.

307 changes: 307 additions & 0 deletions benchmarks/RAM/reports/flat-30.txt

Large diffs are not rendered by default.

307 changes: 307 additions & 0 deletions benchmarks/RAM/reports/flat-50.txt

Large diffs are not rendered by default.

Empty file.
330 changes: 330 additions & 0 deletions benchmarks/RAM/reports/flat-large.txt

Large diffs are not rendered by default.

Binary file added benchmarks/RAM/reports/img/point-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/RAM/reports/img/point-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/RAM/reports/img/point-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/RAM/reports/img/point-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/RAM/reports/img/point-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/RAM/reports/img/point-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added benchmarks/RAM/reports/img/point-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading