SlideShare une entreprise Scribd logo
1  sur  36
Télécharger pour lire hors ligne
Camillo Bruni, Luc Fabresse, Stéphane Ducasse, Igor Stasenko
IWST 2013
Language-side
Foreign Function Interfaces
with NativeBoost
IWST	
  2013	
  @	
  Annecy
Outline
1. Context
2. Existing Solutions
3. NativeBoost
4. Speed Comparison of NativeBoost with other FFIs
5. NativeBoost Internals
6. Conclusion & Future Work
2
IWST	
  2013	
  @	
  Annecy
Context
3
Cairo
OpenGL
LibC
Language
Virtual Machine (VM)
Chipmunk
...
IWST	
  2013	
  @	
  Annecy
Context
4
Language
Virtual Machine (VM)
How to interact with external libraries?
Cairo
OpenGL
LibC
Chipmunk
...
IWST	
  2013	
  @	
  Annecy
Existing Solutions
Language-side Library
VM Extension
VM Plugin
Foreign Function Interface
VM-level
Language-level
5
IWST	
  2013	
  @	
  Annecy
Existing Solutions
Language-side Library
VM Extension
VM Plugin
Foreign Function Interface
VM-level
Language-level
6
costly
IWST	
  2013	
  @	
  Annecy
Existing Solutions
Language-side Library
VM Extension
VM Plugin
Foreign Function Interface
VM-level
Language-level
7
costly
low-level
IWST	
  2013	
  @	
  Annecy
Existing Solutions
Language-side Library
VM Extension
VM Plugin
Foreign Function Interface
VM-level
Language-level
8
slow
fast
costly
low-level
IWST	
  2013	
  @	
  Annecy9
NativeBoost
A language-side
and fast
FFI implementation
IWST	
  2013	
  @	
  Annecy10
Language-side
• Extensible
• Easy to use
• noVM code needed
• no low-level code (C wrapper)
needed
IWST	
  2013	
  @	
  Annecy11
Fast
Transparent
generation of Assembly code
from the language-side
IWST	
  2013	
  @	
  Annecy
NativeBoost Example
12
char* getenv(const char*)
IWST	
  2013	
  @	
  Annecy
NativeBoost Example
13
char* getenv(const char*)
IWST	
  2013	
  @	
  Annecy
NativeBoost Example
14
Regular Smalltalk method
with one argument
IWST	
  2013	
  @	
  Annecy
NativeBoost Example
15
A pragma indicating that
#primitiveNativeCall of #NativeBoost plugin
should be executed when this method is executed
IWST	
  2013	
  @	
  Annecy
NativeBoost Example
16
IWST	
  2013	
  @	
  Annecy
NativeBoost Example
17
types annotation used
to generate marshalling code
char* getenv(const char*)
IWST	
  2013	
  @	
  Annecy
NativeBoost Example
18
the value to be passed
when calling out
IWST	
  2013	
  @	
  Annecy
NativeBoost Example
19
the external library address in
which the function is looked up
IWST	
  2013	
  @	
  Annecy
Speed Comparisons
20
• NativeBoost
• Alien FFI
• C-FFI
• LuaJIT
• Callouts
• Marshalling
• Callbacks
IWST	
  2013	
  @	
  Annecy21
Callout Evaluation
uint clock(void)
Average time
calling out
0%
50%
100%
150%
NativeBoost Alien C-FFI LuaJIT
faster
slower
IWST	
  2013	
  @	
  Annecy22
0%
100%
200%
300%
NativeBoost Alien C-FFI LuaJIT
Marshalling int
int abs(int)
IWST	
  2013	
  @	
  Annecy23
0%
100%
200%
300%
400%
NativeBoost Alien C-FFI LuaJIT
Marshalling char*/String
int printf(char*,int,int)
IWST	
  2013	
  @	
  Annecy24
NativeBoost Alien C-FFI LuaJIT
Marshalling char*/String
char* getenv( char* )
100%
300%
1000%
IWST	
  2013	
  @	
  Annecy25
NativeBoost Alien C-FFI LuaJIT
Marshalling char*/String
char* getenv( char* )
100%
300%
1000%
IWST	
  2013	
  @	
  Annecy26
NativeBoost Alien C-FFI LuaJIT
Marshalling structs
100%
400%
1000%
void
cairo_matrix_multiply (
cairo_matrix_t *result,
cairo_matrix_t *a,
cairo_matrix_t *b)
IWST	
  2013	
  @	
  Annecy27
NativeBoost Alien C-FFI LuaJIT
Callbacks Evaluation
30%
100%
void qsort (
void *base,
size_t nel,
size_t width,
int (*compare)(const void*, const void*))
notsupported
IWST	
  2013	
  @	
  Annecy
Insights into NativeBoost Internals
28
NBExample getenv: ‘PATH’
IWST	
  2013	
  @	
  Annecy
Insights into NativeBoost Internals
29
NBExample getenv: ‘PATH’
IWST	
  2013	
  @	
  Annecy
NBExample getenv: ‘PATH’
Insights into NativeBoost Internals
30
Virtual Machine (VM)
NativeBoost Plugin
IWST	
  2013	
  @	
  Annecy
NBExample getenv: ‘PATH’
Insights into NativeBoost Internals
31
Virtual Machine (VM)
NativeBoost Plugin
Fail if no native code
associated with #getenv:
IWST	
  2013	
  @	
  Annecy
NBExample getenv: ‘PATH’
Insights into NativeBoost Internals
32
Virtual Machine (VM)
NativeBoost Plugin
1. generate native code for marshalling, ...
2. associate it with #getenv:
3. restart the method execution
IWST	
  2013	
  @	
  Annecy
Virtual Machine (VM)
NativeBoost Plugin
Insights into NativeBoost Internals
33
activate the native code
associated with #getenv:
NBExample getenv: ‘PATH’
IWST	
  2013	
  @	
  Annecy
Conclusion
34
• NativeBoost-FFI is:
• Language-side: extensible, high-level code only
• Fast compared to other Smalltalk FFI
• Needs optimizations on Callbacks but that would
require strongVM support
IWST	
  2013	
  @	
  Annecy
Future Work
• Improve NativeBoost Callback performance
• Reuse Alien’sVM Callback support?
• Better integration of NativeBoost with the JIT
• Do not leave JIT-mode when activating a NB
method
35
Camillo Bruni, Luc Fabresse, Stéphane Ducasse, Igor Stasenko
IWST 2013
Language-side
Foreign Function Interfaces
with NativeBoost

Contenu connexe

En vedette

iBizLog. Smalltalking the Web
iBizLog. Smalltalking the WebiBizLog. Smalltalking the Web
iBizLog. Smalltalking the WebESUG
 
Representing Code History with Development Environment Events
Representing Code History with Development Environment EventsRepresenting Code History with Development Environment Events
Representing Code History with Development Environment EventsESUG
 
ESUG 2011 Welcome
ESUG 2011 WelcomeESUG 2011 Welcome
ESUG 2011 WelcomeESUG
 
FAMOOSr 2011
FAMOOSr 2011FAMOOSr 2011
FAMOOSr 2011ESUG
 
Eurydike: Schemaless Object Relational SQL Mapper
Eurydike: Schemaless Object Relational SQL MapperEurydike: Schemaless Object Relational SQL Mapper
Eurydike: Schemaless Object Relational SQL MapperESUG
 
Seaside Esug 2008
Seaside Esug 2008Seaside Esug 2008
Seaside Esug 2008ESUG
 
OOSCM. Object Oriented SCM
OOSCM. Object Oriented SCMOOSCM. Object Oriented SCM
OOSCM. Object Oriented SCMESUG
 

En vedette (7)

iBizLog. Smalltalking the Web
iBizLog. Smalltalking the WebiBizLog. Smalltalking the Web
iBizLog. Smalltalking the Web
 
Representing Code History with Development Environment Events
Representing Code History with Development Environment EventsRepresenting Code History with Development Environment Events
Representing Code History with Development Environment Events
 
ESUG 2011 Welcome
ESUG 2011 WelcomeESUG 2011 Welcome
ESUG 2011 Welcome
 
FAMOOSr 2011
FAMOOSr 2011FAMOOSr 2011
FAMOOSr 2011
 
Eurydike: Schemaless Object Relational SQL Mapper
Eurydike: Schemaless Object Relational SQL MapperEurydike: Schemaless Object Relational SQL Mapper
Eurydike: Schemaless Object Relational SQL Mapper
 
Seaside Esug 2008
Seaside Esug 2008Seaside Esug 2008
Seaside Esug 2008
 
OOSCM. Object Oriented SCM
OOSCM. Object Oriented SCMOOSCM. Object Oriented SCM
OOSCM. Object Oriented SCM
 

Similaire à Language-side Foreign Function Interfaces with NativeBoost

Secure Programming Practices in C++ (NDC Oslo 2018)
Secure Programming Practices in C++ (NDC Oslo 2018)Secure Programming Practices in C++ (NDC Oslo 2018)
Secure Programming Practices in C++ (NDC Oslo 2018)Patricia Aas
 
Protelis: Practical Aggregate Programming - Symposium on Applied Computing (S...
Protelis: Practical Aggregate Programming - Symposium on Applied Computing (S...Protelis: Practical Aggregate Programming - Symposium on Applied Computing (S...
Protelis: Practical Aggregate Programming - Symposium on Applied Computing (S...Danilo Pianini
 
Cross Platform Development with Xamarin
Cross Platform Development with XamarinCross Platform Development with Xamarin
Cross Platform Development with Xamarinbryan costanich
 
Using line based voronoi in arc gis
Using line based voronoi in arc gisUsing line based voronoi in arc gis
Using line based voronoi in arc gisFabien Ancelin
 
Towards a Foundational API for Resilient Distributed Systems Design
Towards a Foundational API for Resilient Distributed Systems DesignTowards a Foundational API for Resilient Distributed Systems Design
Towards a Foundational API for Resilient Distributed Systems DesignDanilo Pianini
 
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adderFpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adderMalik Tauqir Hasan
 
Automated Program Repair, Distinguished lecture at MPI-SWS
Automated Program Repair, Distinguished lecture at MPI-SWSAutomated Program Repair, Distinguished lecture at MPI-SWS
Automated Program Repair, Distinguished lecture at MPI-SWSAbhik Roychoudhury
 
Arduino programming of ML-style in ATS
Arduino programming of ML-style in ATSArduino programming of ML-style in ATS
Arduino programming of ML-style in ATSKiwamu Okabe
 
VisIVOWeb Theory Group
VisIVOWeb Theory GroupVisIVOWeb Theory Group
VisIVOWeb Theory Groupxael105
 
2014 MIPS Progrmming for NTUIM
2014 MIPS Progrmming for NTUIM 2014 MIPS Progrmming for NTUIM
2014 MIPS Progrmming for NTUIM imetliao
 
Integrating Applications: the Reactive Way
Integrating Applications: the Reactive WayIntegrating Applications: the Reactive Way
Integrating Applications: the Reactive WayNicola Ferraro
 
C++ interoperability with other languages
C++ interoperability with other languagesC++ interoperability with other languages
C++ interoperability with other languagesAlberto Bignotti
 
"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG
"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG
"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG🎤 Hanno Embregts 🎸
 
Pushing Swift to the Server
Pushing Swift to the ServerPushing Swift to the Server
Pushing Swift to the Serveribmmobile
 
Swift Summit: Pushing the boundaries of Swift to the Server
Swift Summit: Pushing the boundaries of Swift to the ServerSwift Summit: Pushing the boundaries of Swift to the Server
Swift Summit: Pushing the boundaries of Swift to the ServerChris Bailey
 
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...corehard_by
 
You got database in my cloud!
You got database  in my cloud!You got database  in my cloud!
You got database in my cloud!Liz Frost
 
KubeMonkey를 통한 Chaos Engineering 실전 운영하기 - 윤석찬 (AWS 테크에반젤리스트)
KubeMonkey를 통한 Chaos Engineering 실전 운영하기 - 윤석찬 (AWS 테크에반젤리스트)KubeMonkey를 통한 Chaos Engineering 실전 운영하기 - 윤석찬 (AWS 테크에반젤리스트)
KubeMonkey를 통한 Chaos Engineering 실전 운영하기 - 윤석찬 (AWS 테크에반젤리스트)Channy Yun
 

Similaire à Language-side Foreign Function Interfaces with NativeBoost (20)

Secure Programming Practices in C++ (NDC Oslo 2018)
Secure Programming Practices in C++ (NDC Oslo 2018)Secure Programming Practices in C++ (NDC Oslo 2018)
Secure Programming Practices in C++ (NDC Oslo 2018)
 
Protelis: Practical Aggregate Programming - Symposium on Applied Computing (S...
Protelis: Practical Aggregate Programming - Symposium on Applied Computing (S...Protelis: Practical Aggregate Programming - Symposium on Applied Computing (S...
Protelis: Practical Aggregate Programming - Symposium on Applied Computing (S...
 
Cross Platform Development with Xamarin
Cross Platform Development with XamarinCross Platform Development with Xamarin
Cross Platform Development with Xamarin
 
Using line based voronoi in arc gis
Using line based voronoi in arc gisUsing line based voronoi in arc gis
Using line based voronoi in arc gis
 
Towards a Foundational API for Resilient Distributed Systems Design
Towards a Foundational API for Resilient Distributed Systems DesignTowards a Foundational API for Resilient Distributed Systems Design
Towards a Foundational API for Resilient Distributed Systems Design
 
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adderFpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
Fpga 07-port-rules-gate-delay-data-flow-carry-look-ahead-adder
 
hexMachina WWX 2016
hexMachina WWX 2016hexMachina WWX 2016
hexMachina WWX 2016
 
Automated Program Repair, Distinguished lecture at MPI-SWS
Automated Program Repair, Distinguished lecture at MPI-SWSAutomated Program Repair, Distinguished lecture at MPI-SWS
Automated Program Repair, Distinguished lecture at MPI-SWS
 
Arduino programming of ML-style in ATS
Arduino programming of ML-style in ATSArduino programming of ML-style in ATS
Arduino programming of ML-style in ATS
 
VisIVOWeb Theory Group
VisIVOWeb Theory GroupVisIVOWeb Theory Group
VisIVOWeb Theory Group
 
2014 MIPS Progrmming for NTUIM
2014 MIPS Progrmming for NTUIM 2014 MIPS Progrmming for NTUIM
2014 MIPS Progrmming for NTUIM
 
Integrating Applications: the Reactive Way
Integrating Applications: the Reactive WayIntegrating Applications: the Reactive Way
Integrating Applications: the Reactive Way
 
how u can learn C/C++
how u can learn C/C++ how u can learn C/C++
how u can learn C/C++
 
C++ interoperability with other languages
C++ interoperability with other languagesC++ interoperability with other languages
C++ interoperability with other languages
 
"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG
"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG
"Will Git Be Around Forever? A List of Possible Successors" at UtrechtJUG
 
Pushing Swift to the Server
Pushing Swift to the ServerPushing Swift to the Server
Pushing Swift to the Server
 
Swift Summit: Pushing the boundaries of Swift to the Server
Swift Summit: Pushing the boundaries of Swift to the ServerSwift Summit: Pushing the boundaries of Swift to the Server
Swift Summit: Pushing the boundaries of Swift to the Server
 
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
Object-Oriented Programming in Modern C++. Borislav Stanimirov. CoreHard Spri...
 
You got database in my cloud!
You got database  in my cloud!You got database  in my cloud!
You got database in my cloud!
 
KubeMonkey를 통한 Chaos Engineering 실전 운영하기 - 윤석찬 (AWS 테크에반젤리스트)
KubeMonkey를 통한 Chaos Engineering 실전 운영하기 - 윤석찬 (AWS 테크에반젤리스트)KubeMonkey를 통한 Chaos Engineering 실전 운영하기 - 윤석찬 (AWS 테크에반젤리스트)
KubeMonkey를 통한 Chaos Engineering 실전 운영하기 - 윤석찬 (AWS 테크에반젤리스트)
 

Plus de ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

Plus de ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Dernier

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 

Dernier (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 

Language-side Foreign Function Interfaces with NativeBoost

  • 1. Camillo Bruni, Luc Fabresse, Stéphane Ducasse, Igor Stasenko IWST 2013 Language-side Foreign Function Interfaces with NativeBoost
  • 2. IWST  2013  @  Annecy Outline 1. Context 2. Existing Solutions 3. NativeBoost 4. Speed Comparison of NativeBoost with other FFIs 5. NativeBoost Internals 6. Conclusion & Future Work 2
  • 3. IWST  2013  @  Annecy Context 3 Cairo OpenGL LibC Language Virtual Machine (VM) Chipmunk ...
  • 4. IWST  2013  @  Annecy Context 4 Language Virtual Machine (VM) How to interact with external libraries? Cairo OpenGL LibC Chipmunk ...
  • 5. IWST  2013  @  Annecy Existing Solutions Language-side Library VM Extension VM Plugin Foreign Function Interface VM-level Language-level 5
  • 6. IWST  2013  @  Annecy Existing Solutions Language-side Library VM Extension VM Plugin Foreign Function Interface VM-level Language-level 6 costly
  • 7. IWST  2013  @  Annecy Existing Solutions Language-side Library VM Extension VM Plugin Foreign Function Interface VM-level Language-level 7 costly low-level
  • 8. IWST  2013  @  Annecy Existing Solutions Language-side Library VM Extension VM Plugin Foreign Function Interface VM-level Language-level 8 slow fast costly low-level
  • 9. IWST  2013  @  Annecy9 NativeBoost A language-side and fast FFI implementation
  • 10. IWST  2013  @  Annecy10 Language-side • Extensible • Easy to use • noVM code needed • no low-level code (C wrapper) needed
  • 11. IWST  2013  @  Annecy11 Fast Transparent generation of Assembly code from the language-side
  • 12. IWST  2013  @  Annecy NativeBoost Example 12 char* getenv(const char*)
  • 13. IWST  2013  @  Annecy NativeBoost Example 13 char* getenv(const char*)
  • 14. IWST  2013  @  Annecy NativeBoost Example 14 Regular Smalltalk method with one argument
  • 15. IWST  2013  @  Annecy NativeBoost Example 15 A pragma indicating that #primitiveNativeCall of #NativeBoost plugin should be executed when this method is executed
  • 16. IWST  2013  @  Annecy NativeBoost Example 16
  • 17. IWST  2013  @  Annecy NativeBoost Example 17 types annotation used to generate marshalling code char* getenv(const char*)
  • 18. IWST  2013  @  Annecy NativeBoost Example 18 the value to be passed when calling out
  • 19. IWST  2013  @  Annecy NativeBoost Example 19 the external library address in which the function is looked up
  • 20. IWST  2013  @  Annecy Speed Comparisons 20 • NativeBoost • Alien FFI • C-FFI • LuaJIT • Callouts • Marshalling • Callbacks
  • 21. IWST  2013  @  Annecy21 Callout Evaluation uint clock(void) Average time calling out 0% 50% 100% 150% NativeBoost Alien C-FFI LuaJIT faster slower
  • 22. IWST  2013  @  Annecy22 0% 100% 200% 300% NativeBoost Alien C-FFI LuaJIT Marshalling int int abs(int)
  • 23. IWST  2013  @  Annecy23 0% 100% 200% 300% 400% NativeBoost Alien C-FFI LuaJIT Marshalling char*/String int printf(char*,int,int)
  • 24. IWST  2013  @  Annecy24 NativeBoost Alien C-FFI LuaJIT Marshalling char*/String char* getenv( char* ) 100% 300% 1000%
  • 25. IWST  2013  @  Annecy25 NativeBoost Alien C-FFI LuaJIT Marshalling char*/String char* getenv( char* ) 100% 300% 1000%
  • 26. IWST  2013  @  Annecy26 NativeBoost Alien C-FFI LuaJIT Marshalling structs 100% 400% 1000% void cairo_matrix_multiply ( cairo_matrix_t *result, cairo_matrix_t *a, cairo_matrix_t *b)
  • 27. IWST  2013  @  Annecy27 NativeBoost Alien C-FFI LuaJIT Callbacks Evaluation 30% 100% void qsort ( void *base, size_t nel, size_t width, int (*compare)(const void*, const void*)) notsupported
  • 28. IWST  2013  @  Annecy Insights into NativeBoost Internals 28 NBExample getenv: ‘PATH’
  • 29. IWST  2013  @  Annecy Insights into NativeBoost Internals 29 NBExample getenv: ‘PATH’
  • 30. IWST  2013  @  Annecy NBExample getenv: ‘PATH’ Insights into NativeBoost Internals 30 Virtual Machine (VM) NativeBoost Plugin
  • 31. IWST  2013  @  Annecy NBExample getenv: ‘PATH’ Insights into NativeBoost Internals 31 Virtual Machine (VM) NativeBoost Plugin Fail if no native code associated with #getenv:
  • 32. IWST  2013  @  Annecy NBExample getenv: ‘PATH’ Insights into NativeBoost Internals 32 Virtual Machine (VM) NativeBoost Plugin 1. generate native code for marshalling, ... 2. associate it with #getenv: 3. restart the method execution
  • 33. IWST  2013  @  Annecy Virtual Machine (VM) NativeBoost Plugin Insights into NativeBoost Internals 33 activate the native code associated with #getenv: NBExample getenv: ‘PATH’
  • 34. IWST  2013  @  Annecy Conclusion 34 • NativeBoost-FFI is: • Language-side: extensible, high-level code only • Fast compared to other Smalltalk FFI • Needs optimizations on Callbacks but that would require strongVM support
  • 35. IWST  2013  @  Annecy Future Work • Improve NativeBoost Callback performance • Reuse Alien’sVM Callback support? • Better integration of NativeBoost with the JIT • Do not leave JIT-mode when activating a NB method 35
  • 36. Camillo Bruni, Luc Fabresse, Stéphane Ducasse, Igor Stasenko IWST 2013 Language-side Foreign Function Interfaces with NativeBoost