rabbit-slide-znz-rubykansai67-regexp 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bf187028fcc3ea8c3823936472fecdc111efb54d
4
+ data.tar.gz: d39633f3f84aa8e1aba4833060d1bff3db653702
5
+ SHA512:
6
+ metadata.gz: 11e514acb46c7789319912e5f1a18513658c186b0ff1f78a0717ef910601acbb6a07ceb1bcd455c4071a55abaf40f8ff8c3254dbb0d235908c2c81b0e3f61740
7
+ data.tar.gz: 72974cafbc74189e1fb90e885d98a25a14499ed5716a42970775a1ad2d0fe1fefc8147cec41526cb4a2812e89e8f4737373e41b98d4541c268f024f1dfe7d19a
data/.rabbit ADDED
@@ -0,0 +1 @@
1
+ rubykansai67-regexp.rab
@@ -0,0 +1,23 @@
1
+ # 正規表現の \z の話
2
+
3
+ あるちょっと遅そうな正規表現を高速化した話
4
+
5
+ ## 作者向け
6
+
7
+ ### 表示
8
+
9
+ rake
10
+
11
+ ### 公開
12
+
13
+ rake publish
14
+
15
+ ## 閲覧者向け
16
+
17
+ ### インストール
18
+
19
+ gem install rabbit-slide-znz-rubykansai67-regexp
20
+
21
+ ### 表示
22
+
23
+ rabbit rabbit-slide-znz-rubykansai67-regexp.gem
@@ -0,0 +1,17 @@
1
+ require "rabbit/task/slide"
2
+
3
+ # Edit ./config.yaml to customize meta data
4
+
5
+ spec = nil
6
+ Rabbit::Task::Slide.new do |task|
7
+ spec = task.spec
8
+ # task.spec.files += Dir.glob("doc/**/*.*")
9
+ # task.spec.files -= Dir.glob("private/**/*.*")
10
+ # task.spec.add_runtime_dependency("YOUR THEME")
11
+ end
12
+
13
+ desc "Tag #{spec.version}"
14
+ task :tag do
15
+ sh("git", "tag", "-a", spec.version.to_s, "-m", "Publish #{spec.version}")
16
+ sh("git", "push", "--tags")
17
+ end
@@ -0,0 +1,21 @@
1
+ ---
2
+ id: rubykansai67-regexp
3
+ base_name: rubykansai67-regexp
4
+ tags:
5
+ - ruby
6
+ - regexp
7
+ presentation_date: 2015.6.13
8
+ version: 1.0.0
9
+ licenses: []
10
+ slideshare_id: rubykansai67-regexp
11
+ speaker_deck_id: zheng-gui-biao-xian-false-slash-z-falsehua
12
+ ustream_id:
13
+ vimeo_id:
14
+ youtube_id:
15
+ author:
16
+ markup_language: :rd
17
+ name: Kazuhiro NISHIYAMA
18
+ email: zn@mbf.nifty.com
19
+ rubygems_user: znz
20
+ slideshare_user: znzjp
21
+ speaker_deck_user: znz
@@ -0,0 +1,103 @@
1
+ = 正規表現の \n \z の話
2
+ : subtitle
3
+ あるちょっと遅そうな正規表現を \n 高速化した話
4
+ : author
5
+ Kazuhiro NISHIYAMA
6
+ # : institution
7
+ # 所属
8
+ : content-source
9
+ 第67回 Ruby関西 勉強会
10
+ : date
11
+ 2015/06/13
12
+ : allotted-time
13
+ 5m
14
+ : theme
15
+ default
16
+
17
+ = 自己紹介
18
+
19
+ * twitter や github では @znz
20
+
21
+ # image
22
+ # src = https://secure.gravatar.com/avatar/8e497efbe99e2fa051316337d03624d9?s=200
23
+ # relative_height = 100
24
+
25
+ = Ruby 関連
26
+
27
+ * Ruby (CRuby) のコミッター
28
+ * Ruby 関係でいろいろ
29
+ * るびま (Rubyist Magazine) とか
30
+ * http://magazine.rubyist.net/
31
+ * るりま (Ruby リファレンスマニュアル) とか
32
+ * http://docs.ruby-lang.org/ja/
33
+ * Ruby 関連のイベントでの発表
34
+
35
+ = とある正規表現
36
+
37
+ /(ん|ン)$/
38
+
39
+ * (('wait'))遅そう
40
+ * (('wait'))文字列末尾以外にもマッチする
41
+
42
+ = 文字クラスを使う
43
+
44
+ /[んン]$/
45
+
46
+ * (('wait'))速くなった(ベンチマークは後で)
47
+
48
+ = \z を使う
49
+
50
+ /[んン]\z/
51
+
52
+ * (({$})): 行末にマッチ
53
+ * (({\z})): 文字列末尾のみにマッチ
54
+ * (('wait'))もっと速くなった
55
+
56
+ = ベンチマーク
57
+
58
+ #!/usr/bin/env ruby
59
+ # coding: utf-8
60
+ require 'benchmark'
61
+ s = 'ん' * 10000 + 'ン'
62
+ n = 1000
63
+ Benchmark.bmbm do |x|
64
+ x.report('/(ん|ン)$/') { n.times { /(ん|ン)$/ =~ s } }
65
+ x.report('/[んン]$/') { n.times { /[んン]$/ =~ s } }
66
+ x.report('/(ん|ン)\z/') { n.times { /(ん|ン)\z/ =~ s } }
67
+ x.report('/[んン]\z/') { n.times { /[んン]\z/ =~ s } }
68
+ end
69
+
70
+ = ベンチマーク結果 (1)
71
+
72
+ Rehearsal ---------------------------------------------
73
+ /(ん|ン)$/ 1.560000 0.000000 1.560000 ( 1.561225)
74
+ /[んン]$/ 0.850000 0.000000 0.850000 ( 0.855042)
75
+ /(ん|ン)\z/ 0.020000 0.000000 0.020000 ( 0.015481)
76
+ /[んン]\z/ 0.010000 0.000000 0.010000 ( 0.015520)
77
+ ------------------------------------ total: 2.440000sec
78
+
79
+ user system total real
80
+ /(ん|ン)$/ 1.200000 0.000000 1.200000 ( 1.205324)
81
+ /[んン]$/ 0.900000 0.000000 0.900000 ( 0.896039)
82
+ /(ん|ン)\z/ 0.020000 0.000000 0.020000 ( 0.015274)
83
+ /[んン]\z/ 0.010000 0.000000 0.010000 ( 0.015871)
84
+
85
+ = ベンチマーク結果 (2)
86
+
87
+ Rehearsal ---------------------------------------------
88
+ /(ん|ン)$/ 1.300000 0.000000 1.300000 ( 1.299798)
89
+ /[んン]$/ 0.840000 0.000000 0.840000 ( 0.834954)
90
+ /(ん|ン)\z/ 0.010000 0.000000 0.010000 ( 0.014847)
91
+ /[んン]\z/ 0.020000 0.000000 0.020000 ( 0.014750)
92
+ ------------------------------------ total: 2.170000sec
93
+
94
+ user system total real
95
+ /(ん|ン)$/ 1.110000 0.000000 1.110000 ( 1.105155)
96
+ /[んン]$/ 0.850000 0.000000 0.850000 ( 0.853977)
97
+ /(ん|ン)\z/ 0.010000 0.000000 0.010000 ( 0.015622)
98
+ /[んン]\z/ 0.020000 0.000000 0.020000 ( 0.015683)
99
+
100
+ = まとめ
101
+
102
+ * 1文字の場合は選択 (ん|ン) ではなく文字クラス [んン] を使おう
103
+ * 文字列末尾は $ ではなく \z
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rabbit-slide-znz-rubykansai67-regexp
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Kazuhiro NISHIYAMA
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rabbit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.2
27
+ description: "あるちょっと遅そうな正規表現を高速化した話"
28
+ email:
29
+ - zn@mbf.nifty.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rabbit"
35
+ - README.md
36
+ - Rakefile
37
+ - config.yaml
38
+ - pdf/rubykansai67-regexp-rubykansai67-regexp.pdf
39
+ - rubykansai67-regexp.rab
40
+ homepage: http://slide.rabbit-shocker.org/authors/znz/rubykansai67-regexp/
41
+ licenses: []
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.2.2
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: "正規表現の \\z の話"
63
+ test_files: []