SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
LAUNCHING RUBY IN 32
KILOBYTES
MIKHAIL BORTNYK
LAUNCHING RUBY IN 32 KILOBYTES
WHO AM I
▸ Mikhail Bortnyk, (not only) Ruby developer
▸ kottans.org co-founder
▸ github: @vessi
▸ twitter: @mikhailbortnyk
LAUNCHING RUBY IN 32 KILOBYTES
FOR WHY?
▸ because I can
▸ I love Ruby
▸ interested in IoT
▸ learn more about languages virtual machines
▸ learn more about optimisation
▸ get a touch with a real hardware
▸ I want to get fucking led blinking!
LAUNCHING RUBY IN 32 KILOBYTES
OPTIONS I KNEW BEFORE
▸ Ruby
▸ mRuby
LAUNCHING RUBY IN 32 KILOBYTES
RUBY
▸ Pros:
▸ full language stack
▸ very long story
▸ most of bugs cleared
▸ I have everyday work experience
▸ Cons:
▸ consumes too much memory (valgrind shows ~9Mb)
▸ too big
▸ platform-dependent
▸ bytecode is very experimental
LAUNCHING RUBY IN 32 KILOBYTES
MRUBY
▸ Pros:
▸ relatively smaller
▸ actively supported by @matz
▸ proved builds on bigger MCUs (Raspberry Pi and powerful ChipKIT boards)
▸ code can be compiled into byte code to reduce execution time
▸ Cons:
▸ still consumes too much memory (but only 4% from big Ruby, ~400kb)
▸ has complicated build system
▸ partially connected with filesystem so you can’t use FS-less configurations
LAUNCHING RUBY IN 32 KILOBYTES
LIMITATIONS
▸ Result build should:
▸ fit in 32K of RAM
▸ take less than 512K
▸ can operate without file system
▸ It will be good if result build can operate with target’s
hardware
LAUNCHING RUBY IN 32 KILOBYTES
FIRST TRY
▸ Author: Doug Bradbury
▸ Date: 19 Dec 2008
▸ Target board: Glomation GESBC-2440
▸ Target params: 400MHz ARM CPU, 128 MB SDRAM, 64
MB FLASH and Linux 2.6.18
▸ Ruby version: 1.8.6-p111
LAUNCHING RUBY IN 32 KILOBYTES
NEXT STEP (POSSIBLY NOT VERY ACCURATE)
▸ Author: kyab
▸ Date: 31 Dec 2012
▸ Target board: ChipKIT Max32
▸ Target params: PIC32MX795F512L 80MHz MCU, 128KB RAM, 512KB flash
▸ mRuby version: 1.0.0
▸ Caveats: lost Regexps, reduced heap 16 times (64 objects instead of 1024),
lost Time class, gems are disabled
▸ No REPL, only constant code evaluation
▸ requires MPIDE to cross-compile
AND I HAVE
FOUND
LAUNCHING RUBY IN 32 KILOBYTES
LAUNCHING RUBY IN 32 KILOBYTES
MRUBY/C PROTOTYPE
▸ Author: Shimane IT Open-Innovation Centre (in reality the
only developer is Kazuaki Tanaka)
▸ First presentation of idea: 11 Nov 2015, on slideshare
▸ I found this presentation and wrote email to achieve very
alpha version: 4 Mar 2016
▸ Project gone opensource: 17 Mar 2016
LAUNCHING RUBY IN 32 KILOBYTES
MRUBY/C DESCRIPTION
▸ Written in pure C, Makefiles are used to build
▸ Fits in 16K of memory
▸ Totally lost everything in stdlib, only Array, Float and Object
classes left
▸ More than 40% of VM instructions are not implemented yet
▸ Heap is statically linked (length is configurable in time of
compilation)
DEMO TIME
I AM GOING TO COMPILE RUBY AND BYTECODE,
FLASH BOARDS, BLINK LEDS AND LOOK PROUD
FOR NO REASON
LAUNCHING RUBY IN 32 KILOBYTES
LAUNCHING RUBY IN 32 KILOBYTES
WHAT HAVE I DID
▸ Added cross-compiling system (stolen idea from
micropython)
▸ Added simple HAL to avoid printf calls and remove libc
dependency (-10kb of flash size)
▸ Fixed lambda support (not totally)
▸ Added constants support
LAUNCHING RUBY IN 32 KILOBYTES
WHAT I AM PLANNING TO DO
▸ Add IREP subsequences support (IREP is byte code
sequence)
▸ Add runtime class declaration
▸ Move to dynamic memory management system
▸ Try to port lexer and compiler parts
▸ Try to implement REPL
▸ Try to implement network access (need ESP8266 board!)
LAUNCHING RUBY IN 32 KILOBYTES
THANKS SECTION
▸ To Mykhailo Odyniuk: this work would be totally
impossible without him. He provided me two
development boards I used in time of porting
▸ To Shimane ITOC and Kenji Sugihara personally for quick
replies and good presentation
▸ To Kazuaki Tanaka for the great work he did implementing
alpha and beta versions of mruby/c
LAUNCHING RUBY IN 32 KILOBYTES
KAZUAKI TANAKA
▸ The guy to say ‘Arigato!’
▸ @kaz0505 on Github
▸ Associate professor at Kyushu
Institute of Technology
▸ Profile on LinkedIn
QUESTIONS
AND ANSWERS
LAUNCHING RUBY IN 32 KILOBYTES

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Introducing CentOS container pipeline
Introducing CentOS container pipelineIntroducing CentOS container pipeline
Introducing CentOS container pipeline
 
NUS-ISS Learning Day 2017 - Bots-Managed CloudOps
NUS-ISS Learning Day 2017 - Bots-Managed CloudOpsNUS-ISS Learning Day 2017 - Bots-Managed CloudOps
NUS-ISS Learning Day 2017 - Bots-Managed CloudOps
 
CRI Runtimes Deep-Dive: Who's Running My Pod!?
CRI Runtimes Deep-Dive: Who's Running My Pod!?CRI Runtimes Deep-Dive: Who's Running My Pod!?
CRI Runtimes Deep-Dive: Who's Running My Pod!?
 
Docker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
 
Introduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" EditionIntroduction to Docker, December 2014 "Tour de France" Edition
Introduction to Docker, December 2014 "Tour de France" Edition
 
Docker e git lab
Docker e git labDocker e git lab
Docker e git lab
 
Types - slice, map, new, make, struct - Gopherlabs
Types - slice, map, new, make, struct - Gopherlabs Types - slice, map, new, make, struct - Gopherlabs
Types - slice, map, new, make, struct - Gopherlabs
 
Whose Job Is It Anyway? Kubernetes, CRI, & Container Runtimes
Whose Job Is It Anyway? Kubernetes, CRI, & Container RuntimesWhose Job Is It Anyway? Kubernetes, CRI, & Container Runtimes
Whose Job Is It Anyway? Kubernetes, CRI, & Container Runtimes
 
Docker intro workshop: Dockerize your PHP app
Docker  intro workshop: Dockerize your PHP appDocker  intro workshop: Dockerize your PHP app
Docker intro workshop: Dockerize your PHP app
 
Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...Decision making - for loop , nested loop ,if-else statements , switch in goph...
Decision making - for loop , nested loop ,if-else statements , switch in goph...
 
Gluster containers!
Gluster containers!Gluster containers!
Gluster containers!
 
Workshop on Source control, git merge walkthroughs
Workshop on Source control, git merge walkthroughsWorkshop on Source control, git merge walkthroughs
Workshop on Source control, git merge walkthroughs
 
Build and run applications in a dockerless kubernetes world - DevConf India 18
Build and run applications in a dockerless kubernetes world - DevConf India 18Build and run applications in a dockerless kubernetes world - DevConf India 18
Build and run applications in a dockerless kubernetes world - DevConf India 18
 
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...Vagrant, Ansible and Docker - How they fit together for productive flexible d...
Vagrant, Ansible and Docker - How they fit together for productive flexible d...
 
[KubeCon EU 2020] containerd Deep Dive
[KubeCon EU 2020] containerd Deep Dive[KubeCon EU 2020] containerd Deep Dive
[KubeCon EU 2020] containerd Deep Dive
 
Boston Code Dojo - Docker meetup slides
Boston Code Dojo - Docker meetup slidesBoston Code Dojo - Docker meetup slides
Boston Code Dojo - Docker meetup slides
 
Understand docker
Understand dockerUnderstand docker
Understand docker
 
Fabric8 CI/CD
Fabric8 CI/CDFabric8 CI/CD
Fabric8 CI/CD
 
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
[Paris Container Day 2021] nerdctl: yet another Docker & Docker Compose imple...
 
The world of Containers with Podman, Buildah, Skopeo by Seema - CCDays
The world of Containers with Podman, Buildah, Skopeo by Seema - CCDaysThe world of Containers with Podman, Buildah, Skopeo by Seema - CCDays
The world of Containers with Podman, Buildah, Skopeo by Seema - CCDays
 

Ähnlich wie Let's Count Bytes! Launching Ruby in 32K of RAM

A Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and ContainersA Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and Containers
Docker, Inc.
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
Derek Jacoby
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Docker, Inc.
 

Ähnlich wie Let's Count Bytes! Launching Ruby in 32K of RAM (20)

DockerCon EU 2015: Breaking the RPiDocker Challenge
DockerCon EU 2015: Breaking the RPiDocker Challenge DockerCon EU 2015: Breaking the RPiDocker Challenge
DockerCon EU 2015: Breaking the RPiDocker Challenge
 
Breaking the RpiDocker challenge
Breaking the RpiDocker challenge Breaking the RpiDocker challenge
Breaking the RpiDocker challenge
 
Docker Online Meetup #27: Raspberry Pi DockerCon Challenge
Docker Online Meetup #27: Raspberry Pi DockerCon ChallengeDocker Online Meetup #27: Raspberry Pi DockerCon Challenge
Docker Online Meetup #27: Raspberry Pi DockerCon Challenge
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
 
A Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and ContainersA Gentle Introduction to Docker and Containers
A Gentle Introduction to Docker and Containers
 
Untangling fall2017 week2
Untangling fall2017 week2Untangling fall2017 week2
Untangling fall2017 week2
 
Untangling fall2017 week2_try2
Untangling fall2017 week2_try2Untangling fall2017 week2_try2
Untangling fall2017 week2_try2
 
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special EditionIntroduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
Introduction to Docker, December 2014 "Tour de France" Bordeaux Special Edition
 
Pentesting an unfriendly environment: bypassing (un)common defences and mate ...
Pentesting an unfriendly environment: bypassing (un)common defences and mate ...Pentesting an unfriendly environment: bypassing (un)common defences and mate ...
Pentesting an unfriendly environment: bypassing (un)common defences and mate ...
 
Mono Repo
Mono RepoMono Repo
Mono Repo
 
Take care of hundred containers and not go crazy
Take care of hundred containers and not go crazyTake care of hundred containers and not go crazy
Take care of hundred containers and not go crazy
 
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo..."Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
"Lightweight Virtualization with Linux Containers and Docker". Jerome Petazzo...
 
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
 
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
 
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
Docker 1 0 1 0 1: a Docker introduction, actualized for the stable release of...
 
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQIntroduction to Docker and all things containers, Docker Meetup at RelateIQ
Introduction to Docker and all things containers, Docker Meetup at RelateIQ
 
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
 
Technical presentation of IGDB.com
Technical presentation of IGDB.comTechnical presentation of IGDB.com
Technical presentation of IGDB.com
 

Mehr von Amoniac OÜ

Mehr von Amoniac OÜ (15)

Dokku your own heroku 21
Dokku   your own heroku 21Dokku   your own heroku 21
Dokku your own heroku 21
 
GO in Heterogeneous Language Environments
GO in Heterogeneous Language EnvironmentsGO in Heterogeneous Language Environments
GO in Heterogeneous Language Environments
 
Cleaners of Caribbean
Cleaners of CaribbeanCleaners of Caribbean
Cleaners of Caribbean
 
Ruby JIT Compilation
Ruby JIT CompilationRuby JIT Compilation
Ruby JIT Compilation
 
Ambiguous Sinatra
Ambiguous SinatraAmbiguous Sinatra
Ambiguous Sinatra
 
Capistrano and SystemD
Capistrano and SystemDCapistrano and SystemD
Capistrano and SystemD
 
Distributed Cluster in Ruby
Distributed Cluster in RubyDistributed Cluster in Ruby
Distributed Cluster in Ruby
 
Roda: Putting the Fun Back into Ruby Web Development
Roda: Putting the Fun Back into Ruby Web DevelopmentRoda: Putting the Fun Back into Ruby Web Development
Roda: Putting the Fun Back into Ruby Web Development
 
Rubymotion: Overview and Ecosystem
Rubymotion: Overview and EcosystemRubymotion: Overview and Ecosystem
Rubymotion: Overview and Ecosystem
 
Rupher
RupherRupher
Rupher
 
Different Ways of Integrating React into Rails - Pros and Cons
Different Ways of Integrating React into Rails - Pros and ConsDifferent Ways of Integrating React into Rails - Pros and Cons
Different Ways of Integrating React into Rails - Pros and Cons
 
Functional Web Apps with WebMachine Framework
Functional Web Apps with WebMachine FrameworkFunctional Web Apps with WebMachine Framework
Functional Web Apps with WebMachine Framework
 
Functional Ruby
Functional RubyFunctional Ruby
Functional Ruby
 
How to Become a Сhef
How to Become a СhefHow to Become a Сhef
How to Become a Сhef
 
Deployment tales
Deployment talesDeployment tales
Deployment tales
 

Kürzlich hochgeladen

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

Let's Count Bytes! Launching Ruby in 32K of RAM

  • 1. LAUNCHING RUBY IN 32 KILOBYTES MIKHAIL BORTNYK
  • 2. LAUNCHING RUBY IN 32 KILOBYTES WHO AM I ▸ Mikhail Bortnyk, (not only) Ruby developer ▸ kottans.org co-founder ▸ github: @vessi ▸ twitter: @mikhailbortnyk
  • 3. LAUNCHING RUBY IN 32 KILOBYTES FOR WHY? ▸ because I can ▸ I love Ruby ▸ interested in IoT ▸ learn more about languages virtual machines ▸ learn more about optimisation ▸ get a touch with a real hardware ▸ I want to get fucking led blinking!
  • 4. LAUNCHING RUBY IN 32 KILOBYTES OPTIONS I KNEW BEFORE ▸ Ruby ▸ mRuby
  • 5. LAUNCHING RUBY IN 32 KILOBYTES RUBY ▸ Pros: ▸ full language stack ▸ very long story ▸ most of bugs cleared ▸ I have everyday work experience ▸ Cons: ▸ consumes too much memory (valgrind shows ~9Mb) ▸ too big ▸ platform-dependent ▸ bytecode is very experimental
  • 6. LAUNCHING RUBY IN 32 KILOBYTES MRUBY ▸ Pros: ▸ relatively smaller ▸ actively supported by @matz ▸ proved builds on bigger MCUs (Raspberry Pi and powerful ChipKIT boards) ▸ code can be compiled into byte code to reduce execution time ▸ Cons: ▸ still consumes too much memory (but only 4% from big Ruby, ~400kb) ▸ has complicated build system ▸ partially connected with filesystem so you can’t use FS-less configurations
  • 7. LAUNCHING RUBY IN 32 KILOBYTES LIMITATIONS ▸ Result build should: ▸ fit in 32K of RAM ▸ take less than 512K ▸ can operate without file system ▸ It will be good if result build can operate with target’s hardware
  • 8. LAUNCHING RUBY IN 32 KILOBYTES FIRST TRY ▸ Author: Doug Bradbury ▸ Date: 19 Dec 2008 ▸ Target board: Glomation GESBC-2440 ▸ Target params: 400MHz ARM CPU, 128 MB SDRAM, 64 MB FLASH and Linux 2.6.18 ▸ Ruby version: 1.8.6-p111
  • 9. LAUNCHING RUBY IN 32 KILOBYTES NEXT STEP (POSSIBLY NOT VERY ACCURATE) ▸ Author: kyab ▸ Date: 31 Dec 2012 ▸ Target board: ChipKIT Max32 ▸ Target params: PIC32MX795F512L 80MHz MCU, 128KB RAM, 512KB flash ▸ mRuby version: 1.0.0 ▸ Caveats: lost Regexps, reduced heap 16 times (64 objects instead of 1024), lost Time class, gems are disabled ▸ No REPL, only constant code evaluation ▸ requires MPIDE to cross-compile
  • 10. AND I HAVE FOUND LAUNCHING RUBY IN 32 KILOBYTES
  • 11. LAUNCHING RUBY IN 32 KILOBYTES MRUBY/C PROTOTYPE ▸ Author: Shimane IT Open-Innovation Centre (in reality the only developer is Kazuaki Tanaka) ▸ First presentation of idea: 11 Nov 2015, on slideshare ▸ I found this presentation and wrote email to achieve very alpha version: 4 Mar 2016 ▸ Project gone opensource: 17 Mar 2016
  • 12. LAUNCHING RUBY IN 32 KILOBYTES MRUBY/C DESCRIPTION ▸ Written in pure C, Makefiles are used to build ▸ Fits in 16K of memory ▸ Totally lost everything in stdlib, only Array, Float and Object classes left ▸ More than 40% of VM instructions are not implemented yet ▸ Heap is statically linked (length is configurable in time of compilation)
  • 13. DEMO TIME I AM GOING TO COMPILE RUBY AND BYTECODE, FLASH BOARDS, BLINK LEDS AND LOOK PROUD FOR NO REASON LAUNCHING RUBY IN 32 KILOBYTES
  • 14. LAUNCHING RUBY IN 32 KILOBYTES WHAT HAVE I DID ▸ Added cross-compiling system (stolen idea from micropython) ▸ Added simple HAL to avoid printf calls and remove libc dependency (-10kb of flash size) ▸ Fixed lambda support (not totally) ▸ Added constants support
  • 15. LAUNCHING RUBY IN 32 KILOBYTES WHAT I AM PLANNING TO DO ▸ Add IREP subsequences support (IREP is byte code sequence) ▸ Add runtime class declaration ▸ Move to dynamic memory management system ▸ Try to port lexer and compiler parts ▸ Try to implement REPL ▸ Try to implement network access (need ESP8266 board!)
  • 16. LAUNCHING RUBY IN 32 KILOBYTES THANKS SECTION ▸ To Mykhailo Odyniuk: this work would be totally impossible without him. He provided me two development boards I used in time of porting ▸ To Shimane ITOC and Kenji Sugihara personally for quick replies and good presentation ▸ To Kazuaki Tanaka for the great work he did implementing alpha and beta versions of mruby/c
  • 17. LAUNCHING RUBY IN 32 KILOBYTES KAZUAKI TANAKA ▸ The guy to say ‘Arigato!’ ▸ @kaz0505 on Github ▸ Associate professor at Kyushu Institute of Technology ▸ Profile on LinkedIn