- @kenchan / Twitter
- GMOペパボ株式会社 技術責任者 兼 EC事業部 シニアエンジニアリングリード
- 好きなメソッドは Enumerable#inject
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
| require 'benchmark' | |
| puts "ruby-#{RUBY_VERSION}" | |
| Benchmark.bm(10) do |x| | |
| array = (10 ** 5).times.to_a | |
| x.report 'sum' do |x| | |
| array.sum {|i| i * 2 } | |
| end |
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
| kbd = Keyboard.new | |
| row1 = 0 | |
| row2 = 1 | |
| row3 = 2 | |
| row4 = 3 | |
| row5 = 4 | |
| row6 = 5 | |
| col1 = 11 | |
| col2 = 12 |
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
| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'benchmark-ips' | |
| end | |
| require 'benchmark/ips' | |
| Benchmark.ips do |x| |
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
| require 'benchmark/ips' | |
| Benchmark.ips do |x| | |
| x.report("each") do | |
| s = 0 | |
| (10 ** 5).times.each do |i| | |
| s += i | |
| end | |
| end |
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
| Warming up -------------------------------------- | |
| ** 70.304k i/100ms | |
| my pow 27.298k i/100ms | |
| Calculating ------------------------------------- | |
| ** 1.633M (± 5.7%) i/s - 8.155M in 5.012777s | |
| my pow 345.490k (± 3.6%) i/s - 1.747M in 5.063730s | |
| Comparison: | |
| **: 1632697.1 i/s | |
| my pow: 345489.6 i/s - 4.73x slower |
irb(main):013:0> require 'bigdecimal'
=> false
irb(main):014:0> 10.times.inject(0.0) {|i, _| i + 0.1 }.to_i
=> 0
irb(main):015:0> 10.times.inject(BigDecimal("0.0")) {|i, _| i + BigDecimal("0.1") }.to_i
=> 1
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
| - https://www.hsbt.org/diary/no_comments.rdf | |
| - https://diary.shu-cream.net/atom.xml | |
| - https://june29.jp/index.xml |
- 下着 n 日分
- 服 n 日分
- パジャマ
- バスタオル (ありそう)
- タオル (ありそう)
- ハブラシ
- シェーバー
- モバイルバッテリー
- Apple Watch充電するやつ
- 充電器
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
| console.log("hi"); |
NewerOlder