Permalink
Browse files

add freeze calls to array and hash constants

This has good effects on GC in kiji (a.k.a. Twitter's REE fork).
  • Loading branch information...
1 parent ea8c938 commit 4bf2ac7bd63fdd256b7c35b5989137f6a276b72e @jmhodges committed Dec 2, 2012
View
@@ -922,6 +922,6 @@ module CharDet
13920,13921,13922,13923,13924,13925,13926,13927,13928,13929,13930,13931,13932,13933,13934,13935, #13936
13936,13937,13938,13939,13940,13941,13942,13943,13944,13945,13946,13947,13948,13949,13950,13951, #13952
13952,13953,13954,13955,13956,13957,13958,13959,13960,13961,13962,13963,13964,13965,13966,13967, #13968
-13968,13969,13970,13971,13972] #13973
+13968,13969,13970,13971,13972 #13973
+].freeze
end
-
View
@@ -59,7 +59,7 @@ module CharDet
1,1,1,1,1,1,1,1, # e8 - ef
1,1,1,1,1,1,1,1, # f0 - f7
1,1,1,1,1,1,1,1, # f8 - ff
- ]
+ ].freeze
HZ_st = [
EStart,EError, 3,EStart,EStart,EStart,EError,EError,# 00-07
@@ -68,16 +68,16 @@ module CharDet
5,EError, 6,EError, 5, 5, 4,EError,# 18-1f
4,EError, 4, 4, 4,EError, 4,EError,# 20-27
4,EItsMe,EStart,EStart,EStart,EStart,EStart,EStart,# 28-2f
- ]
+ ].freeze
- HZCharLenTable = [0, 0, 0, 0, 0, 0]
+ HZCharLenTable = [0, 0, 0, 0, 0, 0].freeze
HZSMModel = {'classTable' => HZ_cls,
'classFactor' => 6,
'stateTable' => HZ_st,
'charLenTable' => HZCharLenTable,
'name' => "HZ-GB-2312"
- }
+ }.freeze
ISO2022CN_cls = [
2,0,0,0,0,0,0,0, # 00 - 07
@@ -112,7 +112,7 @@ module CharDet
2,2,2,2,2,2,2,2, # e8 - ef
2,2,2,2,2,2,2,2, # f0 - f7
2,2,2,2,2,2,2,2, # f8 - ff
-]
+].freeze
ISO2022CN_st = [
EStart, 3,EError,EStart,EStart,EStart,EStart,EStart,# 00-07
@@ -123,16 +123,16 @@ module CharDet
5, 6,EError,EError,EError,EError,EError,EError,# 28-2f
EError,EError,EError,EItsMe,EError,EError,EError,EError,# 30-37
EError,EError,EError,EError,EError,EItsMe,EError,EStart,# 38-3f
-]
+].freeze
-ISO2022CNCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0]
+ISO2022CNCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0].freeze
ISO2022CNSMModel = {'classTable' => ISO2022CN_cls,
'classFactor' => 9,
'stateTable' => ISO2022CN_st,
'charLenTable' => ISO2022CNCharLenTable,
'name' => "ISO-2022-CN"
- }
+ }.freeze
ISO2022JP_cls = [
2,0,0,0,0,0,0,0, # 00 - 07
@@ -167,7 +167,7 @@ module CharDet
2,2,2,2,2,2,2,2, # e8 - ef
2,2,2,2,2,2,2,2, # f0 - f7
2,2,2,2,2,2,2,2, # f8 - ff
-]
+].freeze
ISO2022JP_st = [
EStart, 3,EError,EStart,EStart,EStart,EStart,EStart,# 00-07
@@ -179,16 +179,16 @@ module CharDet
EError,EError,EError,EError,EError,EError,EItsMe,EItsMe,# 30-37
EError,EError,EError,EItsMe,EError,EError,EError,EError,# 38-3f
EError,EError,EError,EError,EItsMe,EError,EStart,EStart,# 40-47
-]
+].freeze
-ISO2022JPCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+ISO2022JPCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0].freeze
ISO2022JPSMModel = {'classTable' => ISO2022JP_cls,
'classFactor' => 10,
'stateTable' => ISO2022JP_st,
'charLenTable' => ISO2022JPCharLenTable,
'name' => "ISO-2022-JP"
- }
+ }.freeze
ISO2022KR_cls = [
2,0,0,0,0,0,0,0, # 00 - 07
@@ -223,22 +223,22 @@ module CharDet
2,2,2,2,2,2,2,2, # e8 - ef
2,2,2,2,2,2,2,2, # f0 - f7
2,2,2,2,2,2,2,2, # f8 - ff
-]
+].freeze
ISO2022KR_st = [
EStart, 3,EError,EStart,EStart,EStart,EError,EError,# 00-07
EError,EError,EError,EError,EItsMe,EItsMe,EItsMe,EItsMe,# 08-0f
EItsMe,EItsMe,EError,EError,EError, 4,EError,EError,# 10-17
EError,EError,EError,EError, 5,EError,EError,EError,# 18-1f
EError,EError,EError,EItsMe,EStart,EStart,EStart,EStart,# 20-27
-]
+].freeze
-ISO2022KRCharLenTable = [0, 0, 0, 0, 0, 0]
+ISO2022KRCharLenTable = [0, 0, 0, 0, 0, 0].freeze
ISO2022KRSMModel = {'classTable' => ISO2022KR_cls,
'classFactor' => 6,
'stateTable' => ISO2022KR_st,
'charLenTable' => ISO2022KRCharLenTable,
'name' => "ISO-2022-KR"
- }
+ }.freeze
end
@@ -592,5 +592,5 @@ module CharDet
8704,8705,8706,8707,8708,8709,8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,
8720,8721,8722,8723,8724,8725,8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,
8736,8737,8738,8739,8740,8741
-]
+].freeze
end
@@ -426,5 +426,6 @@ module CharDet
8678,8679,8680,8681,8682,8683,8684,8685,8686,8687,8688,8689,8690,8691,8692,8693, # 8694
8694,8695,8696,8697,8698,8699,8700,8701,8702,8703,8704,8705,8706,8707,8708,8709, # 8710
8710,8711,8712,8713,8714,8715,8716,8717,8718,8719,8720,8721,8722,8723,8724,8725, # 8726
-8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741] # 8742
+8726,8727,8728,8729,8730,8731,8732,8733,8734,8735,8736,8737,8738,8739,8740,8741 # 8742
+].freeze
end
@@ -469,6 +469,6 @@ module CharDet
6271,3875,5768,6094,5034,5506,4376,5769,6761,2120,6476,5253,5770,6762,5771,5970,
3990,5971,5557,5558,5772,6477,6095,2787,4641,5972,5121,6096,6097,6272,6763,3703,
5867,5507,6273,4206,6274,4789,6098,6764,3619,3646,3833,3804,2394,3788,4936,3978,
-4866,4899,6099,6100,5559,6478,6765,3599,5868,6101,5869,5870,6275,6766,4527,6767]
-
+4866,4899,6099,6100,5559,6478,6765,3599,5868,6101,5869,5870,6275,6766,4527,6767
+].freeze
end
View
@@ -566,5 +566,6 @@ module CharDet
8208,8209,8210,8211,8212,8213,8214,8215,8216,8217,8218,8219,8220,8221,8222,8223, # 8224
8224,8225,8226,8227,8228,8229,8230,8231,8232,8233,8234,8235,8236,8237,8238,8239, # 8240
8240,8241,8242,8243,8244,8245,8246,8247,8248,8249,8250,8251,8252,8253,8254,8255, # 8256
-8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271] # 8272
+8256,8257,8258,8259,8260,8261,8262,8263,8264,8265,8266,8267,8268,8269,8270,8271 # 8272
+].freeze
end
@@ -53,7 +53,7 @@ module CharDet
1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, # d0
7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,241, 42, 16, # e0
62,242,243,244, 58,245, 98,246,247,248,249,250,251, 91,252,253, # f0
-]
+].freeze
win1251BulgarianCharToOrderMap = [
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
@@ -72,7 +72,7 @@ module CharDet
39, 28, 34, 51, 48, 49, 53, 50, 54, 57, 61,251, 67,252, 60, 56, # d0
1, 18, 9, 20, 11, 3, 23, 15, 2, 26, 12, 10, 14, 6, 4, 13, # e0
7, 8, 5, 19, 29, 25, 22, 21, 27, 24, 17, 75, 52,253, 42, 16, # f0
-]
+].freeze
# Model Table:
# total sequences: 100%
@@ -209,21 +209,21 @@ module CharDet
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,0,1,1,1,1,1,0,1,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
-]
+].freeze
Latin5BulgarianModel = {
'charToOrderMap' => Latin5_BulgarianCharToOrderMap,
'precedenceMatrix' => BulgarianLangModel,
'mTypicalPositiveRatio' => 0.969392,
'keepEnglishLetter' => false,
'charsetName' => "ISO-8859-5"
-}
+}.freeze
Win1251BulgarianModel = {
'charToOrderMap' => win1251BulgarianCharToOrderMap,
'precedenceMatrix' => BulgarianLangModel,
'mTypicalPositiveRatio' => 0.969392,
'keepEnglishLetter' => false,
'charsetName' => "windows-1251"
-}
+}.freeze
end
@@ -46,7 +46,7 @@ module CharDet
15, 16, 9, 7, 6, 14, 24, 10, 17, 18, 20, 25, 30, 29, 22, 54, # d0
59, 37, 44, 58, 41, 48, 53, 46, 55, 42, 60, 36, 49, 38, 31, 34, # e0
35, 43, 45, 32, 40, 52, 56, 33, 61, 62, 51, 57, 47, 63, 50, 70, # f0
-]
+].freeze
win1251_CharToOrderMap = [
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
@@ -65,7 +65,7 @@ module CharDet
45, 32, 40, 52, 53, 55, 58, 50, 57, 63, 70, 62, 61, 47, 59, 43,
3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15,
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16,
-]
+].freeze
latin5_CharToOrderMap = [
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
@@ -84,7 +84,7 @@ module CharDet
3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15,
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16,
239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255,
-]
+].freeze
macCyrillic_CharToOrderMap = [
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
@@ -103,7 +103,7 @@ module CharDet
239,240,241,242,243,244,245,246,247,248,249,250,251,252, 68, 16,
3, 21, 10, 19, 13, 2, 24, 20, 4, 23, 11, 8, 12, 5, 1, 15,
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27,255,
-]
+].freeze
IBM855_CharToOrderMap = [
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
@@ -122,7 +122,7 @@ module CharDet
8, 49, 12, 38, 5, 31, 1, 34, 15,244,245,246,247, 35, 16,248,
43, 9, 45, 7, 32, 6, 40, 14, 52, 24, 56, 10, 33, 17, 61,249,
250, 18, 62, 20, 51, 25, 57, 30, 47, 29, 63, 22, 50,251,252,255,
-]
+].freeze
IBM866_CharToOrderMap = [
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
@@ -141,7 +141,7 @@ module CharDet
223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,
9, 7, 6, 14, 39, 26, 28, 22, 25, 29, 54, 18, 17, 30, 27, 16,
239, 68,240,241,242,243,244,245,246,247,248,249,250,251,252,255,
-]
+].freeze
# Model Table:
# total sequences: 100%
@@ -278,53 +278,53 @@ module CharDet
1,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,1,1,0,1,0,0,0,
0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
-]
+].freeze
Koi8rModel = {
'charToOrderMap' => KOI8R_CharToOrderMap,
'precedenceMatrix' => RussianLangModel,
'mTypicalPositiveRatio' => 0.976601,
'keepEnglishLetter' => false,
'charsetName' => "KOI8-R"
-}
+}.freeze
Win1251CyrillicModel = {
'charToOrderMap' => win1251_CharToOrderMap,
'precedenceMatrix' => RussianLangModel,
'mTypicalPositiveRatio' => 0.976601,
'keepEnglishLetter' => false,
'charsetName' => "windows-1251"
-}
+}.freeze
Latin5CyrillicModel = {
'charToOrderMap' => latin5_CharToOrderMap,
'precedenceMatrix' => RussianLangModel,
'mTypicalPositiveRatio' => 0.976601,
'keepEnglishLetter' => false,
'charsetName' => "ISO-8859-5"
-}
+}.freeze
MacCyrillicModel = {
'charToOrderMap' => macCyrillic_CharToOrderMap,
'precedenceMatrix' => RussianLangModel,
'mTypicalPositiveRatio' => 0.976601,
'keepEnglishLetter' => false,
'charsetName' => "MacCyrillic"
-}
+}.freeze
Ibm866Model = {
'charToOrderMap' => IBM866_CharToOrderMap,
'precedenceMatrix' => RussianLangModel,
'mTypicalPositiveRatio' => 0.976601,
'keepEnglishLetter' => false,
'charsetName' => "IBM866"
-}
+}.freeze
Ibm855Model = {
'charToOrderMap' => IBM855_CharToOrderMap,
'precedenceMatrix' => RussianLangModel,
'mTypicalPositiveRatio' => 0.976601,
'keepEnglishLetter' => false,
'charsetName' => "IBM855"
-}
+}.freeze
end
@@ -51,7 +51,7 @@ module CharDet
35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, # d0
124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, # e0
9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, # f0
- ]
+ ].freeze
Win1253_CharToOrderMap = [
255,255,255,255,255,255,255,255,255,255,254,255,255,254,255,255, # 00
@@ -70,7 +70,7 @@ module CharDet
35, 48,250, 37, 33, 45, 56, 50, 84, 57,120,121, 17, 18, 22, 15, # d0
124, 1, 29, 20, 21, 3, 32, 13, 25, 5, 11, 16, 10, 6, 30, 4, # e0
9, 8, 14, 7, 2, 12, 28, 23, 42, 24, 64, 75, 19, 26, 27,253, # f0
- ]
+ ].freeze
# Model Table:
# total sequences: 100%
@@ -207,21 +207,21 @@ module CharDet
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- ]
+ ].freeze
Latin7GreekModel = {
'charToOrderMap' => Latin7_CharToOrderMap,
'precedenceMatrix' => GreekLangModel,
'mTypicalPositiveRatio' => 0.982851,
'keepEnglishLetter' => false,
'charsetName' => "ISO-8859-7"
- }
+ }.freeze
Win1253GreekModel = {
'charToOrderMap' => Win1253_CharToOrderMap,
'precedenceMatrix' => GreekLangModel,
'mTypicalPositiveRatio' => 0.982851,
'keepEnglishLetter' => false,
'charsetName' => "windows-1253"
- }
+ }.freeze
end
@@ -53,7 +53,7 @@ module CharDet
238, 38, 45,239,240,241,242,243,127,244,245,246,247,248,249,250,
9, 8, 20, 16, 3, 2, 24, 14, 22, 1, 25, 15, 4, 11, 6, 23,
12, 19, 13, 26, 18, 27, 21, 17, 7, 10, 5,251,252,128, 96,253,
-]
+].freeze
# Model Table:
# total sequences: 100%
@@ -190,13 +190,13 @@ module CharDet
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0,
-]
+].freeze
Win1255HebrewModel = {
'charToOrderMap' => Win1255_CharToOrderMap,
'precedenceMatrix' => HebrewLangModel,
'mTypicalPositiveRatio' => 0.984004,
'keepEnglishLetter' => false,
'charsetName' => "windows-1255"
-}
+}.freeze
end
Oops, something went wrong.

0 comments on commit 4bf2ac7

Please sign in to comment.