Slide 1

Slide 1 text

࣮ߦ࣌ʹ͓͚Δ +7.όΠτίʔυ ࠷దԽٕ๏ todesking@maverick

Slide 2

Slide 2 text

୭ w !UPEFTLJOHGSPN.BWFSJDL JOD w 7JNͰ4DBMBΛॻ͍͍ͯΔ w 8FC޿ࠂܥͷ࢓ࣄΛ͍ͯ͠·͕͢ɺओʹ1%'ͷϨ ϯμϦϯάΤϯδϯͳͲΛ࡞͍ͬͯΔ

Slide 3

Slide 3 text

͋Β͢͡ w 4DBMB͸ߴ౓ͳந৅ԽػೳΛ࣋ͭ w ந৅Խ͸ΦʔόϔουΛ൐͏ w ಛఆͷ৚݅Ͱ͸ɺ͜ͷΦʔόϔου͕க໋త w ࣮ߦ࣌ʹόΠτίʔυॻ͖׵͑ͯ͸΍͘͢Δ΍ͭΛ ͭͬͨ͘

Slide 4

Slide 4 text

$IBQUFS 4DBMB͸ศར

Slide 5

Slide 5 text

4DBMBͷ ͞·͟·ͳந৅Խػߏ w Ϋϥε w USBJUʹΑΔNJYJO w VOBQQMZʹΑΔΧελϚΠζՄೳͳύλʔϯϚο ν w ܕΫϥε w *NQMJDJUDPOWFSTJPO w ϑΝʔετΫϥεͳؔ਺

Slide 6

Slide 6 text

4DBMBͷಛੑ w 001ͱ'1ͷػೳ͕࢖͑Δ w খ͞ͳ൚༻෦඼Λ૊Έ߹Θͤͯ࠶ར༻͢Δͷ͕༰қ ʹ

Slide 7

Slide 7 text

$IBQUFSಈػ

Slide 8

Slide 8 text

4DBMB.BUTVSJ

Slide 9

Slide 9 text

3FKFDUFE

Slide 10

Slide 10 text

ͳͷͰ ͜͜Ͱ ൃද͠·͢

Slide 11

Slide 11 text

ϞδϡϥʔγϯηαΠβʔ Photo by Nina Richards https://commons.wikimedia.org/wiki/File:Doepfer_A-100.jpg

Slide 12

Slide 12 text

ԿΛ͍͔ͨ͠ w ϞδϡϥʔγϯηൃৼثɺϑΟϧλͳͲͷجຊత ͳϞδϡʔϧΛଟ਺૊Έ߹ΘͤͯԻΛ࡞Δγϯηα Πβʔ w 4DBMBͰϞδϡϥʔͳγϯηΛͭ͘Γ͍ͨ

Slide 13

Slide 13 text

දݱ͍ͨ͠ཁૉ 7$0 7$' -'0 + z-1 Ϟδϡʔϧؒͷ઀ଓ ৴߸ॲཧͷ಺༰

Slide 14

Slide 14 text

දݱ͍ͨ͠ཁૉ w ͜ΕΒͷجຊཁૉͰදݱͰ͖ Δ w ઀ଓ w ෼഑ w ߹ྲྀ w ϧʔϓ w 4DBMBͰͲ͏ॻ͘

Slide 15

Slide 15 text

"SSPX w ܕΫϥεͷͻͱͭ w 'VODUJPOBM3FBDUJWF1SPHSBNNJOHͰΑ͘ ࢖ΘΕͯΔ https://wiki.haskell.org/Yampa

Slide 16

Slide 16 text

"SSPXʹΑΔදݱ + z-1 val z_1 = init(0.0) val plus = arr { case (a, b) => a + b } val out = in >>> (z_1 &&& id) >>> plus

Slide 17

Slide 17 text

"SSPXʹΑΔදݱ + z-1 val z_1 = init(0.0) val plus = arr { case (a, b) => a + b } val out = in >>> (z_1 &&& id) >>> (plus *** (arr(_._1) >>> z_1)) >>> plus + z-1 (´ŋ_ŋ`)???

Slide 18

Slide 18 text

"SSPXه๏ w 4DBMBʹ͓͍ͯɺϞφυ͸GPS DPNQSFIFOTJPOͰॻ͚Δ w "SSPX΋γϯλΫεγϡΨʔͰॻ͖͍ͨ w )BTLFMMʹ͸"SSPX༻ͷγϯλΫεγϡΨʔͰ ͋ΔQSPDه๏͕͋Δ w 4DBMBͰ΋΍Γ͍ͨʂ΍Γ·ͨ͠ʂ w HJUIVCUPEFTLJOHBSSPX@CVJMEFSTDBMB

Slide 19

Slide 19 text

"SSPXʹΑΔදݱ XJUITZOUBYTVHBS + z-1 val z_1 = init(0.0) val plus = arr { case (a, b) => a + b } val out = for { a <- z_1 -< in b <- plus -< (in, a) c <- z_1 -< a d <- plus -< (b, c) } yield d + z-1 ʋ(´ʔʆ)ϊಡΊΔಡΊΔ a b c d in

Slide 20

Slide 20 text

"SSPX࠷ߴ

Slide 21

Slide 21 text

͔͠͠ɺ

Slide 22

Slide 22 text

"SSPXʹΑΔ ৴߸ॲཧͷ࣮૷ ؔ਺߹੒ͷଟ༻

Slide 23

Slide 23 text

"SSPXʹΑΓ ߏஙͨ͠ ৴߸ॲཧϑϩʔͷྫ w ؙ͍ͷ͕ؔ਺ɺ ໼ҹ͕߹੒ w ӈ൒෼Ҏ্Λ ઎ΊͯΔͷ͕ جຊతͳϞ δϡʔϧͷͻ ͱͭɺ7$' w Ϟδϡʔϧ; ͨͭܨ͍ͩͩ ͚Ͱ͜Ε

Slide 24

Slide 24 text

໰୊͸Φʔόʔϔου w ओཁͳॲཧͱൺֱͯؔ͠਺߹੒ͱUVQMJOHͷ਺͕๲ େ w ϦΞϧλΠϜͰԻ੠ग़ྗ͍ͨ͠ͷͰɺ͜ͷΦϒδΣ ΫτάϥϑΛLճTFD΄ͲධՁ͢Δඞཁ͕͋ Δ w ͍͘ΒϝϞϦ֬อ΍ؔ਺ݺͼग़͠ͷίετ͕௿͍ͱ ݴͬͯ΋ɺͪΐͬͱ͜Ε͸

Slide 25

Slide 25 text

ந৅Խʹ͸ϦεΫ͕͋Δ w ύϑΥʔϚϯεΦʔόϔου w ଟ͘ͷ৔߹͸ɺ࣮༻্໰୊ʹͳΒͳ͍ w ໰୊ʹͳΔ৔߹͸ɺϗοτεϙοτͷΈ࠷దԽ͢Ε ͹Α͍ w ͔͠͠ɺϗοτεϙοτ͕දݱ͍ͨ͠υϝΠϯͦͷ ΋ͷͩͬͨ৔߹͸ʁ w ந৅ԽΛࣺͯͯϕλॻ͖͢Δ͔͠ͳ͍ͷ͔

Slide 26

Slide 26 text

$IBQUFSΦʔό ϔου܏޲ͱରࡦ

Slide 27

Slide 27 text

ؔ਺߹੒Ͱൃੜ͢Δ Φʔόϔου w ෆ༻ͳΠϯελϯεͷੜ੒ #PYJOH5VQMJOH w ෆ༻ͳϝιουݺͼग़͠ w ্هʹΑΔɺ࠷దԽػձͷݮগ

Slide 28

Slide 28 text

طଘͷ࠷దԽख๏ w 4DBMBίϯύΠϥ͕͓͜ͳ͏࠷దԽ w +7.ͷ+*5ίϯύΠϥʹΑΔ࠷దԽ

Slide 29

Slide 29 text

#PYJOH5VQMJOH w (FOFSJDͳؔ਺ͷҾ਺͸࣮࣭0CKFDU w ϓϦϛςΟϒܕΛ౉͍ͨ͠৔߹͸#PYJOHൃੜ • Integer.valueOf(n) w ෳ਺ͷ஋Λฦ͍ͨ͠৔߹͸5VQMFΛ࡞Δඞཁ͕͋ Δ w ϝϞϦ֬อͷίετɺ($ͷίετ͕ൃੜ

Slide 30

Slide 30 text

4DBMBίϯύΠϥʹΑΔ ࠷దԽ w ಛघԽ w ܕύϥϝʔλʹ@specializedΞϊςʔγϣϯΛ͚ͭΔ͜ͱͰࢦఆ w ܕύϥϝʔλ͕ϓϦϛςΟϒܕͷ৔߹ʹରͯ͠ɺઐ༻ͷϝιουΛ ੜ੒͢Δ͜ͱͰCPYJOHΛෆཁʹ w ૊Έ߹Θͤͷ਺͚ͩϝιουΫϥε͕૿͑Δͱ͍͏σϝϦοτ͋Γ w ૊Έ߹Θͤ਺ΛݮΒ͢NJOJCPYJOHͱ͍͏ख๏΋͋Δ ͨͩ͠4DBMB ຊՈʹ͸ೖͬͯͳ͠ trait Function1[ @specialized(scala.Int, scala.Long, scala.Float, scala.Double) -T1, @specialized(scala.Unit, scala.Boolean, scala.Int, scala.Float, scala.Long, scala.Double) +R ] extends AnyRef { self => ྫ: scala.Function1ͷఆٛ

Slide 31

Slide 31 text

4DBMBίϯύΠϥʹΑΔ ࠷దԽ w &MJNJOBUFOPOFTDBQJOHCPYFT UVQMFT BOESFGT w ίϯύΠϧ࣌ʹɺϝιου಺Ͱ׬͍݁ͯ͠Δ CPYJOHUVQMJOHΛআڈ͢Δ w ͰೖΔΒ͍͠Ͱ͢ w ϝιουΛ·͍ͨͩ࠷దԽͰ͸ͳ͍ͷͰɺޮՌ͸͔ ͳΓݶఆతͰ͸ͱ͍͏ؾ͕͠·͢

Slide 32

Slide 32 text

+7.ʹΑΔ࠷దԽ w ΤεέʔϓղੳʹΑΔΠϯελϯεੜ੒আڈ w Ұൠతʹ͸4DBMBSSFQMBDFNFOUͳͲͱ͍͏ Β͍͠ w ϝιου֎ʹ࿐ग़͍ͯ͠ͳ͍ΦϒδΣΫτΛΠϯ ϥΠϯԽ w ߴ଎ͳϝϞϦ֬อͱ($ॲཧ w OFX΍($ͷίετΛۃݶ·ͰݮΒͤ͹Ͳ͏ͱ͍ ͏͜ͱ͸ͳ͍

Slide 33

Slide 33 text

Ծ૝ؔ਺ݺͼग़͠ w SFDFJWFSͷΫϥεΛݩʹಈతʹݺͼઌΛม͑Δ w ༧ଌࠔ೉ͳؒ઀෼ذ͸ޮ཰͕ѱ͍ w Ծ૝Ͱͳͯ͘΋ɺؔ਺ݺͼग़͠͸ίετ͕͔͔Δ w ϓϩάϥϜͷෳࡶԽ͸࠷దԽΛ્֐͢Δ class A { def foo: Int = 10 } class B extends A { def foo = 99 } class X { def bar(a: A) = a.foo // 10? 99? }

Slide 34

Slide 34 text

4DBMBίϯύΠϥʹΑΔ ࠷దԽ w !JOMJOF w Ξϊςʔγϣϯ͕ࢦఆ͞Εͨϝιουͷݺͼग़͠ ΛίϯύΠϧ࣌ʹΠϯϥΠϯԽ w ຤ඌ࠶ؼ࠷దԽ!UBJMSFD w ຤ඌ࠶ؼݺͼग़͠Λϧʔϓʹల։

Slide 35

Slide 35 text

+7.ʹΑΔ࠷దԽ w *OMJOJOH w Α͘ݺͼग़͞ΕΔখ͍͞ϝιουΛ࣮ߦ࣌ʹΠϯ ϥΠϯల։͢Δ w ݺͼग़͞ΕΔϝιουͷީิ͕ݶΒΕ͍ͯΔ৔߹ɺ Ծ૝ؔ਺ݺͼग़͠ΛܕνΣοΫ௚઀ݺͼग़͠ʹม ׵ w +*5ίϯύΠϥͷৄࡉʹؔ͢Δࢿྉ͸๡͍͠ͷͰɺ ΘΓͱṖʹแ·Ε͍ͯ·͢ 0QFO+%,ͷίʔυΛ ͕Μ͹ͬͯಡΊ͹͍͍ΜͰ͕͢ʜʜ

Slide 36

Slide 36 text

$IBQUFSطଘͷ ࠷దԽ͸े෼͔

Slide 37

Slide 37 text

"SSPXͷओ໾͸ ؔ਺߹੒

Slide 38

Slide 38 text

ؔ਺߹੒ͷ ύϑΥʔϚϯεΛ ଌఆͯ͠ΈΔ

Slide 39

Slide 39 text

ؔ਺߹੒ͷ ύϑΥʔϚϯε w YTMPXFS standardF ௨ৗͷؔ਺߹੒ 4515.900 ± 154.250 baseline ߹੒ͤͣ௚઀ݺͿ 21772.108 ± 154.944 val f1: Int => Int = { x => x + 1 } val f2: Int => Double = { x => x + 10.0 } val f3: Double => Int = { x => (x * 100).toInt } val f4: Int => Double = { x => x + 1.5 } val f5: Double => Double = { x => x * 0.01 } val f6: Double => Double = { x => x - 200.0 } val f7: Double => Int = { x => x.toInt } val f8: Int => Int = { x => x + 10 } ! val baseline = { def F(x: Int) = f8(f7(f6(f5(f4(f3(f2(f1(x)))))))) x: Int => F(F(F(F(x)))) } ! val standardF = { def F = f1 andThen f2 andThen f3 andThen f4 andThen f5 andThen f6 andThen f7 andThen f8 F andThen F andThen F andThen F }

Slide 40

Slide 40 text

4DBMBʹ͓͚Δؔ਺߹੒ class Comopse[A, B, C]( f: Function1[A, B], g: Function1[B, C] ) extends Function1[A, B] { def apply(x: A) = g(f(a)) } Compose Function1 Compose Function1 Compose Function1 Compose Function1 Function1

Slide 41

Slide 41 text

ؔ਺߹੒͸ ಛघԽ͞Ε͍ͯͳ͍ • unspecialized(´ŋ_ŋ`) w ૊Έ߹ΘͤരൃΛݮΒͨ͢Ίͷ൑அͩͱࢥΘΕ·͢ @annotation.unspecialized def andThen[A](g: R => A): T1 => A = { x => g(apply(x)) }

Slide 42

Slide 42 text

Fun1[Int,(Int, Int)] ͸ಛघԽ͞Εͳ͍ w 'VODUJPOͷಛघԽ͸ɺҰ෦ͷ૊Έ߹Θͤʹݶఆ w Ҿ਺ɾฦΓ஋ͷҰ෦͕ࢀরܕͷέʔε͸ɺಛघԽͷର৅ʹ ͳΒͳ͍ w Ϋϥεɾϝιου਺ͷ૿ՃͱύϑΥʔϚϯε޲্Λఱṝʹ ͔͚ͨ݁ՌͩͱࢥΘΕΔ

Slide 43

Slide 43 text

+*5ίϯύΠϥʹΑΔ JOMJOJOH΋ແཧ w 'VODUJPOͷαϒΫϥε͸େྔʹଘࡏ w ͭ·Γɺݺͼग़͞ΕΔՄೳੑͷ͋ΔԾ૝ؔ਺ͷީิ ͕େྔʹ͋Δ w ࠷దԽ્͕֐͞Ε͍ͯΔ͓ͦΕ

Slide 44

Slide 44 text

+*5ίϯύΠϥ͸ #PYJOHΛಛʹέΞͯ͠ͳ͍ w ˞ࢿྉ͕๡͍͠ͷͰਪଌͰ͢ w JOMJOJOH͕੒ޭ͢Ε͹ ͯ͠ͳ͍ ɺΤεέʔϓղੳ ͰআڈͰ͖Δ͕ʜʜ

Slide 45

Slide 45 text

ίϯύΠϧ࣌ͷ ࠷దԽ͸ ݶք͕͋Δ w ϥΠϒϥϦ͸ಈతʹϦϯΫ͞ΕΔͷͰɺΫϥεΛ௒ ͑ͨ࠷దԽ͸ඇৗʹ೉͍͠ w ಛघԽ͸ɺࣄલʹ͢΂ͯͷϓϦϛςΟϒܕͷ૊Έ߹ ΘͤΛ४උ͢Δ͜ͱ͸ࠔ೉ˠޮՌ͕ݶఆ͞ΕΔ w NJOJCPYJOHΈ͍ͨͳςΫ͸͋Δ͚Ͳඪ४ϥΠ ϒϥϦʹಋೖ͞Εͯͳ͍ΜͰʜʜ

Slide 46

Slide 46 text

+*5ίϯύΠϧʹ͸ ݶք͕͋Δ w ಁաతʹಈ࡞͢Δඞཁ͕͋Δ w ॲཧ࣌ؒͷ੍໿ w ͍͔ͳΔ৔߹΋ڍಈมߋͯ͠͸ͳΒͳ͍ w ͋ΒΏΔϓϩάϥϜʹରͯ͠ɺͦΕͳΓʹಈ͘ඞ ཁ͕͋Δ

Slide 47

Slide 47 text

$IBQUFS ! खܰͳ࣮૷Ͱ ؔ਺߹੒ͷߴ଎Խ

Slide 48

Slide 48 text

4DBMBίϯύΠϥʹ΋ +7.ʹ΋ແཧͳΒɺ ࣗલͰ࠷దԽ͢Δ͔͠ͳ͍ w ॲཧ࣌ؒͷ੍໿ͳ͠ w ڍಈΛม͑ͯ΋͍͍ w ݶఆ͞Εͨ໨తͷͨΊͷ࠷దԽ͕Ͱ͖Δ

Slide 49

Slide 49 text

࣮ߦϑΣʔζͷ෼ղ w ໨తͷΞϓϦέʔγϣϯ͸ɺΦϒδΣΫτάϥϑͷ ߏஙˠ࣮ߦͱ͍͏ߏ੒ def main() = { // ΦϒδΣΫτάϥϑͷߏங val arrow: Long => Double = buildArrow() // ࣮ߦ while(true) { run(arrow) } }

Slide 50

Slide 50 text

ΞϓϦέʔγϣϯಛੑʹ جͮ͘࠷దԽ w ΦϒδΣΫτάϥϑͷߏங͸࠷ॳ͚ͩ w ͜ͷ෦෼ͷύϑΥʔϚϯε͸ॏཁͰ͸ͳ͍ w ߏங͞Εͨάϥϑ͸ଟ਺࣮ߦ͞ΕΔ w ͖ΘΊͯߴ଎ʹ࣮ߦ͍ͨ͠

Slide 51

Slide 51 text

࠷దԽϑΣʔζͷಋೖ def main() = { // ΦϒδΣΫτάϥϑͷߏங val arrow: Long => Double = buildArrow() // ࠷దԽ val optimized = optimize(arrow) // ࣮ߦ while(true) { run(optimized) } }

Slide 52

Slide 52 text

खܰͳ࣮૷Ͱ ߴ଎Խͯ͠ΈΔ w ؔ਺߹੒ΛΫϥεʹ·ͱΊɺಛघԽϝιουΛ࢖ ͏ w Ծ૝ϝιουݺͼग़͠ͱCPYJOH͕໰୊ w $PNQPTF/Έ͍ͨͳΫϥε࡞Ε͹ղܾ͢Δ w ࣄલʹશύλʔϯੜ੒͸ݱ࣮తͰ͸ͳ͍ͷͰɺ࣮ߦ ࣌ʹ΍Δ

Slide 53

Slide 53 text

Ϋϥεੜ੒ʹΑΔ࣮૷ w +BWBTTJTUϥΠϒϥϦͰ͜͏͍͏ΫϥεΛಈతʹ ࡞Δ clas Compose5 extends Function1 { val f1: Function1 val f2: Function1 // ... def apply(a: Any) = apply$ID(a) def apply$ID(a: Int): Double = { f5$ID(f4$II(f3$DI(f2$ID(f1$II(a)))) } // ... }

Slide 54

Slide 54 text

Ϋϥεੜ੒ʹΑΔ࣮૷ w ίʔϧελοΫ͕ઙ͘ͳΔ w ϝιουݺͼग़͠ίετͷ௿ݮ w +*5ίϯύΠϥ΁ͷ༏͠͞ w CPYJOHͷআڈ w ͕ظ଴Ͱ͖Δ

Slide 55

Slide 55 text

MethodHandleʹΑΔ࣮૷ w MethodHandle+7.ʹ͓͚Δؔ਺ϙΠϯλ w +7.͕ಛผѻ͍ͯ͘͠ΕΔͷͰ࠷దԽͷΦϙνϡ χςΟ͕͓͓͖͍ w +7.࢓༷Ͱ΋ϝιουݺͼग़࣌͠ͷಛผѻ͍͕໌ ݴ͞ΕͯΔ w .)ͷ߹੒΋αϙʔτ͍ͯ͠Δ

Slide 56

Slide 56 text

MethodHandle API w MethodHandles.identity(klass)߃౳ؔ਺ w MethodHandles.lookup().findVirtual(klass, name, type).bind(obj):ಛఆͷΠϯελϯεͷ Ծ૝ؔ਺Λද͢.)ΛಘΔ w MethodHandles.filterReturnValue(mh1, mh2) .)ͷฦΓ஋ʹผͷ.)Λద༻ w ͜ΕΒΛ࢖͑͹ؔ਺߹੒͕දݱՄೳ

Slide 57

Slide 57 text

ϕϯνϚʔΫ݁Ռ w ͪΐͬͱ଎͘ͳΓ·ͨ͠Ͷ w .FUIPE)BOEMF࢖͑͹Ϋϥεੜ੒ͳ͠ͰΦʔό ϔου࡟ݮͰ͖ΔͷͰ͓ಘ w ͔͠͠CBTFMJOF·Ͱ͸ԕ͍ standard ௨ৗͷؔ਺߹੒ 4515.900 ± 154.250 fast ߹੒Ϋϥεͷੜ੒ 5499.803 ± 183.904 fastMH MethodHandleʹΑΔ߹੒ 5476.340 ± 45.937 baseline ߹੒ͤͣ௚઀ݺͿ 21772.108 ± 154.944 ୯Ґ: k ops/sec

Slide 58

Slide 58 text

ίʔυެ։ͯ͠·͢ w IUUQTHJUIVCDPNUPEFTLJOH GBTU@GVODUJPO@DPNQPTFSTDBMB

Slide 59

Slide 59 text

$IBQUFS ! ൚༻ੑͷ͋Δ ࣮ߦ࣌ όΠτίʔυ࠷దԽ

Slide 60

Slide 60 text

ߟ͑ํ w ϑΟʔϧυΛ༥߹ͤͯ͞Ծ૝ؔ਺ݺͼग़͠Λ࡟ݮ w ϑΟʔϧυ಺ͰϝιουͷΠϯϥΠϯԽ

Slide 61

Slide 61 text

ϑΟʔϧυͷ༥߹ w Ծ૝ؔ਺ݺͼग़͠Λ࣮ؔ਺ݺͼग़͠ʹม׵Ͱ͖Δ w +*5ίϯύΠϧͰͷ࠷దԽ΋͖͖΍͘͢ͳΔ͔΋ class A(b: B) { def foo = b.bar + 1 } class B(c: C) { def bar = 99 + c.baz } class C { def baz = 111 } class A_opt(b: B) extends A{ def foo = b_bar + 1 def b_bar = 99 + b_c_baz def b_c_baz = 111 }

Slide 62

Slide 62 text

ϝιουͷΠϯϥΠϯԽ w ϑΟʔϧυ༥߹ޙɺಉҰΠϯελϯε಺Ͱͷϝιο υΠϯϥΠϯԽΛߦ͏ class A_opt(b: B) extends A{ def foo = b_bar + 1 def b_bar = 99 + b_c_baz def b_c_baz = 111 } class A_opt2(b: B) extends A{ def foo = 99 + 111 + 1 }

Slide 63

Slide 63 text

ϕϯν݁Ռ w ر๬͕ݟ͖͑ͯ·ͨ͠Ͷ w ؔ਺ݺͼग़͠ίετͷపఈͨ͠࡟ݮͱɺ+*5ίϯύΠϧʹΑΔ ࠷దԽ͕ޮ͖΍͍͢ܗࣜʹͳͬͨ͜ͱ͕଎౓ʹͭͳ͕ͬͨͱݟ ͍ͯ·͢ w CBTFMJOFͱͷࠩ͸ɺCPYJOH͕ফͤͯͳ͍ͷ͕ؔ܎ͯͦ͠͏ standard ௨ৗͷؔ਺߹੒ 4640.914 ± 77.983 fused Field fusionద༻ 7187.380 ± 321.257 fuseInlined Field Fusion + Method Inlining 12924.076 ± 207.785 baseline ߹੒ͤͣ௚઀ݺͿ 21841.596 ± 223.906 ୯Ґ: k ops/sec

Slide 64

Slide 64 text

൚༻ੑ͕͋Δ w ؔ਺߹੒ʹݶఆ͞Εͳ͍ɺ൚༻తͳΦϒδΣΫτά ϥϑͷ࠷దԽ͕ՄೳͱͳΔ w ͔͍͍ͬ͜͠ɺ࣮༻ੑ͕͋Δ<ཁग़య>

Slide 65

Slide 65 text

࣮૷ͷৄࡉ w ΫϥεϑΝΠϧૢ࡞ʹ͸+BWBTTJTUΛ࢖༻ w όΠτίʔυղੳͳͲ͸αϙʔτ͕ͳ͍ͷͰࣗલ Ͱ΍ͬͯ·͢

Slide 66

Slide 66 text

࣮૷ͷৄࡉ 'JFMEGVTJPO w ࢖༻͞Ε͍ͯΔϝιουͷಛఆ w ͦΕΒͷϝιου͕ґଘ͍ͯ͠Δϝιουͷಛఆ w ͦΕΒͷϝιου͕࢖༻͍ͯ͠ΔϑΟʔϧυΛ߹੒ w ϝιουࢀরͷॻ͖׵͑

Slide 67

Slide 67 text

όΠτίʔυղੳ w UIJTʹର͢Δૢ࡞Λॻ͖׵͍͑ͨ w ಛఆͷϑΟʔϧυʹର͢Δؔ਺ݺͼग़͠Λॻ͖׵͑ ͍ͨ w ͳͲͷधཁ͕͋ΓɺόΠτίʔυΛղੳͯͦ͠ΕΒ ͷ৘ใΛಘΔඞཁ͕͋Γ·͢

Slide 68

Slide 68 text

#ZUFDPEF w +7.͸ελοΫϚγϯ w ϝιουϩʔΧϧͷ஋͸ελοΫͱϩʔΧϧม਺ʹ อଘ͞ΕΔ w ஋ʹ͸ܕ͕͋Δ w Ϋϥε࢖༻࣌ʹܕ͕߹͍ͬͯΔ͔+7.͕ݕূ

Slide 69

Slide 69 text

σʔλϑϩʔղੳ w +7.4Ͱݴٴ͞ΕͯΔ΍ͭͱ͍͍͓ͩͨͳ͡Ͱ͢

Slide 70

Slide 70 text

Ϋϥεͷมܗ͸೉͍͠ w ϝϯόʹ͸ΞΫηεݖ͕͋Δ w QSJWBUFϑΟʔϧυΛࢀর͍ͯ͠ΔQVCMJDϝιο υΛॻ͖׵͑Δʹ͸ɺͦͷϑΟʔϧυ΋Ұॹʹ࣋ͬ ͯ͘Δඞཁ͕͋Δ w ύϑΥʔϚϯεతͳཧ༝͔ΒɺϦϑϨΫγϣϯ͸࢖ ͍·ͤΜ

Slide 71

Slide 71 text

Ϋϥεੜ੒ w ϑΟʔϧυʹద੾ͳ஋Ληοτ͢Δඞཁ͕͋Δ w ਌ΫϥεͷpOBMϑΟʔϧυʹ΋ w ਌ΫϥεͷίϯετϥΫλʹ͸ద੾ͳ஋Λ౉͞Ͷ͹ ͳΒͳ͍ w ਌ͷίϯετϥΫλΛղੳͯ͠Ҿ਺ͱϑΟʔϧυͷ ؔ܎ΛϚοϐϯά͠ɺͦΕΛݩʹίϯετϥΫλ࣮ ૷ͱҾ਺ΛٻΊΔ

Slide 72

Slide 72 text

Ϋϥεੜ੒ ίϯετϥΫλղੳ w $ͷαϒΫϥεΛఆ͍ٛͨ͠ w "Yͷ஋͸"ίϯετϥΫλͷୈҰҾ਺͕࢖ΘΕΔ w #Zͷ஋͸#ίϯετϥΫλͷୈҰҐҾ਺͕࢖ΘΕΔ w #ίϯετϥΫλ͸" ΛݺͿ w $ίϯετϥΫλͷҾ਺͸Ͱ͋Δ΂͖ w ͱ͍͏͜ͱΛɺϑΟʔϧυͷ஋ͱ֤Ϋϥεఆ͔ٛΒٻΊΔ class A(val x: Int) class B(val y: Int) extends A(1) class C(val x: Int) extends B(x) ! optimize(new C(1))

Slide 73

Slide 73 text

࣮ࡍͷมܗ w ΦϒδΣΫτͷωετ͕ਂ͗ͯ͢ϑΟʔϧυ໊͕͍͢͜͝ͱʹ w ΫϥεϑΝΠϧͷϝϯό਺੍ݶ΍Ҿ਺ɺόΠτίʔυ௕ͷ੍ݶ ͳͲ΋ߟྀ͠ͳ͍ͱ·ͣͦ͏ͳ༧ײ͕͠·͢

Slide 74

Slide 74 text

ίʔυެ։ͯ͠·͢ w IUUQTHJUIVCDPNUPEFTLJOH6OWFJM

Slide 75

Slide 75 text

$IBQUFS·ͱΊ

Slide 76

Slide 76 text

·ͱΊ w ࣮ߦ࣌ʹόΠτίʔυΛ࠷దԽͯ͠ΦʔόϔουΛ ݮΒͨ͢Ίͷख๏Λఏࣔ͠·ͨ͠ w ந৅ԽΛอͪͳ͕Β࣮ߦ࣌ͷ଎౓Λ޲্ͤ͞ΒΕΔ ر๬͕ݟ͖͑ͯͨ

Slide 77

Slide 77 text

ͲΜͳͱ͖ʹ༗ޮͳͷ ͔ w খ͞ͳΦϒδΣΫτ͕ଟ਺߹੒͞Ε͍ͯΔ w ΦϒδΣΫτͷੜ੒ճ਺࣮ߦճ਺ w ຊ౰ʹύϑΥʔϚϯε΍ϨΠςϯγ͕ॏཁ w ந৅ԽΛࣺͯͨ͘ͳ͍ w ৴߸ॲཧҎ֎ͩͱ w ݴޠॲཧܥ w Ҩ఻తϓϩάϥϛϯά w +BWBͷ1BUUFSOΫϥεʹ΋ద༻Ͱ͖Δ͔΋

Slide 78

Slide 78 text

ࠓޙͷల๬ w ·ͩαϙʔτͯ͠ͳ͍ཁૉ͕ଟ͍ w OFXͱ͔ྫ֎ϋϯυϥͱ͔ w ΠϯλϑΣʔεͷσϑΥϧτ࣮૷΍*O%Z w 4DBMBͰ࢖ͬͯͳ͍͍͍͔͠ͱࢥͬͨΒɺ࠾༻ ͷಈ͖͕ w ҆શͳॻ͖׵͑ͷอো w ͜ͷॻ͖׵͑͸Ͳ͏͍ͬͨ৚݅ͷ΋ͱͰ҆શͳͷ ͔ ͱ͍͏ͷΛ։ൃऀͷצʹཔ͍ͬͯΔ w ܗࣜతख๏ɺಋೖ͍ͨ͠Ͱ͢Ͷʜʜ

Slide 79

Slide 79 text

ؔ࿈ࢿྉ w 4PPU w όΠτίʔυղੳ࠷దԽϥΠϒϥϦͷ࿝ฮ w ͪ͜Β͸੩తͳม׵Λલఏͱ͍ͯ͠ΔΑ͏Ͱ͢ w 4USFBN+*5 w $PNNFOTBM$PNQJMFS֓೦ w .FUIPE)BOEMFͷݩωλ w ੴ࡚Ұ໌ࢯͷ֤छࢿྉ w +7.͕࠾༻͍ͯ͠Δ࠷దԽख๏ʹ͍ͭͯͷوॏͳࢿྉ w ೥୅લ൒ʹॻ͔Εͨ΋ͷͰ͕͢ɺ+*5ίϯύΠϥͷॲཧʹͭ ͍ͯॻ͔Εͨࢿྉ͸ຊ౰ʹগͳ͍ͷͰوॏ w (JPSHJE[F (FPSHF.PEVMBS4ZOUIFTJ[FS1SPHSBNNJOHJO)BTLFMM%JTT.4D%JTTFSUBUJPO %FQBSUNFOUPG$PNQVUFS4DJFODFBOE&OHJOFFSJOH %JWJTJPOPG$PNQVUJOH4DJFODF $IBMNFST 6OJWFSTJUZPG5FDIOPMPHZBOE5IF6OJWFSTJUZPG(PUIFOCVSH (PUIFOCVSH 4XFEFO w )BLFMM:BNQBͰϞδϡϥʔγϯη࡞Δ࿩