SlideShare uma empresa Scribd logo
1 de 20
Autor: 29.05.14
Autor: 29.05.14
詳細 Sagittarius
Takashi Kato
Twitter: @tk_riple
For Shibuya.lisp
Autor: 29.05.14
Autor: 29.05.14
構成
ReaderReader
CompilerCompiler
VMVM
Datum
VM instructions
Autor: 29.05.14
Autor: 29.05.14
Reader
Macro DispatcherMacro Dispatcher
#(#( ####
OthersOthers
#(#( #u#u OthersOthers
ReaderReader CompilerCompiler(cons #(#f) #u(3 4))
Autor: 29.05.14
Autor: 29.05.14
Reader
● 読込はリードマクロベース
● マクロは単一マクロと複合マクロの 2 種類
● シンボルと数値のみ特殊扱い
● ユーザはリードマクロの拡張可能
– 作用はポート単位
● Scheme からのリードテーブルのコピーは不可
– 要望があればつけるかも
Autor: 29.05.14
Autor: 29.05.14
Compiler
Expand&Convert
Optimise
EmitEmit
VMVM
Compiler
Autor: 29.05.14
Autor: 29.05.14
Compiler
● マクロ展開と中間表現への変換は同時に行う
● 最適化はそれなり
– インライン展開
– 定数畳み込み
– 未使用変数除去
– 副作用のない式の除去 ( ゆるい判別 )
– ラムダシフティング
● VM インストラクションの融合
Autor: 29.05.14
Autor: 29.05.14
VM
● いくつかのレジスタを持つスタックマシン
– AC, CL, PC, FP, SP 等
– 32 個の多値レジスタ
– その他
● インストラクションを逐次実行するだけ
● 可能なら Direct Threaded を使う ( 例 :GCC)
● 速度的にはそこそこ
Autor: 29.05.14
Autor: 29.05.14
Misc features
● Builtin CLOS
● FASL
● Replacible reader
● Compiler macro
● Regular expression engine
Autor: 29.05.14
Autor: 29.05.14
Builtin CLOS
● Tiny CLOS ベース
– CL, Gauche からもいろいろ拝借
● 総称関数は CL に近い
– :primary, :before, :after, :around 等サポート
– eql specializer も組み込みでサポート
● 性能は今一
– 実行時に適用可能メソッドの計算をするため
– fact が 200 倍遅い
Autor: 29.05.14
Autor: 29.05.14
FASL
● マクロ展開はコストが高い
– 結果をキャッシュ
● ライブラリ単位で生成
● 通常のファイル読み込みよりはるかに高速
● スクリプト自体には適用されない
– 起動時間短縮するならライブラリ必須
Autor: 29.05.14
Autor: 29.05.14
Replacible reader
● ユーザが Reader を定義できる
● SRFI-49 及び SRFI-110 の実装に使用
● 最終的に S 式に落とせばよいという発想
● 正直お遊び機能
– 面白 SRFI 等の実装くらいにしか使ってない
Autor: 29.05.14
Autor: 29.05.14
Compiler macro
● (core inline) で定義 ( 未ドキュメント )
● 手続きに対して定義されるマクロ
– CL のとほぼ同義
● 現状では単なる inliner
– コンパイル時情報の見せ方等が不満
– もうすこし賢いやり方がいる
Autor: 29.05.14
Autor: 29.05.14
Regular expression engine
● 自前のハイブリッド正規表現エンジン
– RE2 を参考にした O(n) エンジン
– Gauche を参考にした最大 O(n^2) エンジン
● 一部の拡張正規表現を使わない限り O(n)
● あまり最適化されてない
– 速度的に ( 今のところ ) 不満はない
– 鬼車と比較されると・・・
Autor: 29.05.14
Autor: 29.05.14
Philosophy
PerformancePerformance
UsabilityUsability
FunFun
※ 人物像はイメージです
※ カメラは持ってません
PortabilityPortability
Autor: 29.05.14
Autor: 29.05.14
Usability
● 使い捨てスクリプトを書き易く
– ライブラリの充実
– リードマクロ
● 外の世界と繋がる
– FFI, ソケット等の物理層
– DBI, SOAP, MQ 等のアプリ層
● 標準規格をサポート
– RnRS, RFC 等
Autor: 29.05.14
Autor: 29.05.14
遅い=悪
● 選ばれにくい
● 業務で使う際にストレスがたまる
遅い=悪
● 選ばれにくい
● 業務で使う際にストレスがたまる
Performance
VS.VS.
チューニングはコストがかかる
● 開発リソースは一人
● どこかで妥協する必要がある
チューニングはコストがかかる
● 開発リソースは一人
● どこかで妥協する必要がある
Autor: 29.05.14
Autor: 29.05.14
Fun
● 基本的には遊び機能
– Replacible reader 等
– あれば使うかもしれない的な何か
● 後発の処理系なので多少奇をてらってはいる
– こういうのは実装するのが楽しい
– 使うときも割と楽しい
Autor: 29.05.14
Autor: 29.05.14
Portability
● 本体は可能な限りポータブルに
– 意欲的にいろいろな OS をサポート
– OS 依存コードはメンテしやすいように
– そうはいっても C のマクロは要る
● Scheme コードは特に気にしない
– RnRS 準拠である理由がない
– Github でたまに作る程度
Autor: 29.05.14
Autor: 29.05.14
Any Question?
Autor: 29.05.14
Autor: 29.05.14
Thank you!

Mais conteúdo relacionado

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Inside of Sagittarius (ja)

  • 1. Autor: 29.05.14 Autor: 29.05.14 詳細 Sagittarius Takashi Kato Twitter: @tk_riple For Shibuya.lisp
  • 3. Autor: 29.05.14 Autor: 29.05.14 Reader Macro DispatcherMacro Dispatcher #(#( #### OthersOthers #(#( #u#u OthersOthers ReaderReader CompilerCompiler(cons #(#f) #u(3 4))
  • 4. Autor: 29.05.14 Autor: 29.05.14 Reader ● 読込はリードマクロベース ● マクロは単一マクロと複合マクロの 2 種類 ● シンボルと数値のみ特殊扱い ● ユーザはリードマクロの拡張可能 – 作用はポート単位 ● Scheme からのリードテーブルのコピーは不可 – 要望があればつけるかも
  • 6. Autor: 29.05.14 Autor: 29.05.14 Compiler ● マクロ展開と中間表現への変換は同時に行う ● 最適化はそれなり – インライン展開 – 定数畳み込み – 未使用変数除去 – 副作用のない式の除去 ( ゆるい判別 ) – ラムダシフティング ● VM インストラクションの融合
  • 7. Autor: 29.05.14 Autor: 29.05.14 VM ● いくつかのレジスタを持つスタックマシン – AC, CL, PC, FP, SP 等 – 32 個の多値レジスタ – その他 ● インストラクションを逐次実行するだけ ● 可能なら Direct Threaded を使う ( 例 :GCC) ● 速度的にはそこそこ
  • 8. Autor: 29.05.14 Autor: 29.05.14 Misc features ● Builtin CLOS ● FASL ● Replacible reader ● Compiler macro ● Regular expression engine
  • 9. Autor: 29.05.14 Autor: 29.05.14 Builtin CLOS ● Tiny CLOS ベース – CL, Gauche からもいろいろ拝借 ● 総称関数は CL に近い – :primary, :before, :after, :around 等サポート – eql specializer も組み込みでサポート ● 性能は今一 – 実行時に適用可能メソッドの計算をするため – fact が 200 倍遅い
  • 10. Autor: 29.05.14 Autor: 29.05.14 FASL ● マクロ展開はコストが高い – 結果をキャッシュ ● ライブラリ単位で生成 ● 通常のファイル読み込みよりはるかに高速 ● スクリプト自体には適用されない – 起動時間短縮するならライブラリ必須
  • 11. Autor: 29.05.14 Autor: 29.05.14 Replacible reader ● ユーザが Reader を定義できる ● SRFI-49 及び SRFI-110 の実装に使用 ● 最終的に S 式に落とせばよいという発想 ● 正直お遊び機能 – 面白 SRFI 等の実装くらいにしか使ってない
  • 12. Autor: 29.05.14 Autor: 29.05.14 Compiler macro ● (core inline) で定義 ( 未ドキュメント ) ● 手続きに対して定義されるマクロ – CL のとほぼ同義 ● 現状では単なる inliner – コンパイル時情報の見せ方等が不満 – もうすこし賢いやり方がいる
  • 13. Autor: 29.05.14 Autor: 29.05.14 Regular expression engine ● 自前のハイブリッド正規表現エンジン – RE2 を参考にした O(n) エンジン – Gauche を参考にした最大 O(n^2) エンジン ● 一部の拡張正規表現を使わない限り O(n) ● あまり最適化されてない – 速度的に ( 今のところ ) 不満はない – 鬼車と比較されると・・・
  • 14. Autor: 29.05.14 Autor: 29.05.14 Philosophy PerformancePerformance UsabilityUsability FunFun ※ 人物像はイメージです ※ カメラは持ってません PortabilityPortability
  • 15. Autor: 29.05.14 Autor: 29.05.14 Usability ● 使い捨てスクリプトを書き易く – ライブラリの充実 – リードマクロ ● 外の世界と繋がる – FFI, ソケット等の物理層 – DBI, SOAP, MQ 等のアプリ層 ● 標準規格をサポート – RnRS, RFC 等
  • 16. Autor: 29.05.14 Autor: 29.05.14 遅い=悪 ● 選ばれにくい ● 業務で使う際にストレスがたまる 遅い=悪 ● 選ばれにくい ● 業務で使う際にストレスがたまる Performance VS.VS. チューニングはコストがかかる ● 開発リソースは一人 ● どこかで妥協する必要がある チューニングはコストがかかる ● 開発リソースは一人 ● どこかで妥協する必要がある
  • 17. Autor: 29.05.14 Autor: 29.05.14 Fun ● 基本的には遊び機能 – Replacible reader 等 – あれば使うかもしれない的な何か ● 後発の処理系なので多少奇をてらってはいる – こういうのは実装するのが楽しい – 使うときも割と楽しい
  • 18. Autor: 29.05.14 Autor: 29.05.14 Portability ● 本体は可能な限りポータブルに – 意欲的にいろいろな OS をサポート – OS 依存コードはメンテしやすいように – そうはいっても C のマクロは要る ● Scheme コードは特に気にしない – RnRS 準拠である理由がない – Github でたまに作る程度