This document summarizes Rubinius, an implementation of the Ruby programming language that includes a bytecode virtual machine written in C++ and Ruby. Some key points:
- Rubinius compiles Ruby code to bytecode that runs on its built-in virtual machine. This provides performance improvements over interpreting Ruby code.
- The virtual machine is implemented in both C++ and Ruby to provide flexibility. It can inline methods, perform just-in-time compilation, and garbage collect memory.
- Rubinius aims to be a complete Ruby implementation while also improving performance through techniques like inline caching, profiling, and garbage collection optimizations.
The document discusses exporting models trained with S4TF to CoreML format in Swift.
It provides code to:
1. Generate Swift data structures from CoreML protobuf definitions to represent models
2. Export an S4TF model defined with layers, weights, and hyperparameters to the CoreML format
3. Compile, make predictions, and perform personalization/training using the exported CoreML model
The personalization process involves:
1. Generating training data
2. Preparing batch providers for input/output
3. Configuring and running a training task on the CoreML model
4. Saving the retrained model
The document suggests automating the export process by extending S
The document discusses Scala programming concepts including object-oriented programming, functional programming, collections, pattern matching, and more. It provides code examples of defining objects and classes, functions, for expressions, match expressions, case classes, traits, generics, and collections like List and Map.
The document discusses various idioms in Swift including optional binding with guard let and if let, nil coalescing operator, switch statements with optionals and associated values, closures, lazy properties, and computed properties with property observers. Key idioms covered include using guard let to ensure non-nil arguments, extracting associated values from enums using switch, initializing immutable variables with closures, and updating for loops to the Swift 3 syntax.
Max Koretskyi "Why are Angular and React so fast?"Fwdays
The document discusses optimization techniques used in Angular and React to improve performance. It explains that both frameworks use monomorphic property access by enforcing that all view/fiber nodes share the same "hidden class" or shape. This avoids expensive property lookups and allows properties to be accessed over 10,000 times faster. The document also discusses how bit fields and bit masks are used to efficiently represent side effects and other metadata in React fiber nodes. Bloom filters are mentioned as something Angular uses in its dependency injection system.
The document provides five rules for presenting code in slides: 1) Use a monospaced font for readability, 2) Use large fonts that are visible from the back of the room, 3) Only highlight syntax where needed to avoid walls of text, 4) Use ellipses (...) to remove unnecessary code, and 5) Add annotations to draw attention to specific parts of the code. It then demonstrates these rules by presenting an example of using promises in JavaScript to avoid nested callbacks.
The document discusses arrays in C++. It defines an array as a collection of similar data types that share a common name and whose elements can be distinguished using indexes. It provides the syntax for declaring arrays and examples. It also describes different methods for initializing arrays and provides sample questions and solutions demonstrating how to read from, modify, and sort arrays in C++.
Type safe embedded domain-specific languagesArthur Xavier
Language is everything; it governs our lives: from our thought processes, our communication abilities and our understanding of the world, all the way up to law, politics, logic and programming. All of these domains of human experience are governed by different languages that talk to each other, and so should be your code. Haskell provides all the means necessary—and many more—to easily and safely use embedded small languages that are tailored to specific needs and business domains.
In this series of lectures and workshops, we will explore the whats, whys and hows of embedded domain-specific languages in Haskell, and how language oriented programing can bring type-safety, composability and simplicity to the development of complex applications.
The document discusses exporting models trained with S4TF to CoreML format in Swift.
It provides code to:
1. Generate Swift data structures from CoreML protobuf definitions to represent models
2. Export an S4TF model defined with layers, weights, and hyperparameters to the CoreML format
3. Compile, make predictions, and perform personalization/training using the exported CoreML model
The personalization process involves:
1. Generating training data
2. Preparing batch providers for input/output
3. Configuring and running a training task on the CoreML model
4. Saving the retrained model
The document suggests automating the export process by extending S
The document discusses Scala programming concepts including object-oriented programming, functional programming, collections, pattern matching, and more. It provides code examples of defining objects and classes, functions, for expressions, match expressions, case classes, traits, generics, and collections like List and Map.
The document discusses various idioms in Swift including optional binding with guard let and if let, nil coalescing operator, switch statements with optionals and associated values, closures, lazy properties, and computed properties with property observers. Key idioms covered include using guard let to ensure non-nil arguments, extracting associated values from enums using switch, initializing immutable variables with closures, and updating for loops to the Swift 3 syntax.
Max Koretskyi "Why are Angular and React so fast?"Fwdays
The document discusses optimization techniques used in Angular and React to improve performance. It explains that both frameworks use monomorphic property access by enforcing that all view/fiber nodes share the same "hidden class" or shape. This avoids expensive property lookups and allows properties to be accessed over 10,000 times faster. The document also discusses how bit fields and bit masks are used to efficiently represent side effects and other metadata in React fiber nodes. Bloom filters are mentioned as something Angular uses in its dependency injection system.
The document provides five rules for presenting code in slides: 1) Use a monospaced font for readability, 2) Use large fonts that are visible from the back of the room, 3) Only highlight syntax where needed to avoid walls of text, 4) Use ellipses (...) to remove unnecessary code, and 5) Add annotations to draw attention to specific parts of the code. It then demonstrates these rules by presenting an example of using promises in JavaScript to avoid nested callbacks.
The document discusses arrays in C++. It defines an array as a collection of similar data types that share a common name and whose elements can be distinguished using indexes. It provides the syntax for declaring arrays and examples. It also describes different methods for initializing arrays and provides sample questions and solutions demonstrating how to read from, modify, and sort arrays in C++.
Type safe embedded domain-specific languagesArthur Xavier
Language is everything; it governs our lives: from our thought processes, our communication abilities and our understanding of the world, all the way up to law, politics, logic and programming. All of these domains of human experience are governed by different languages that talk to each other, and so should be your code. Haskell provides all the means necessary—and many more—to easily and safely use embedded small languages that are tailored to specific needs and business domains.
In this series of lectures and workshops, we will explore the whats, whys and hows of embedded domain-specific languages in Haskell, and how language oriented programing can bring type-safety, composability and simplicity to the development of complex applications.
This document discusses Kotlin delegation and how it can be used to extend class behavior without subclassing. It provides examples of external and internal delegation in Kotlin. It also discusses how properties in Kotlin can be delegated to other objects by implementing interfaces like ReadOnlyProperty or using standard delegates from the Kotlin library. Real-world use cases demonstrated include binding views in Android, using dependency injection frameworks like Dagger, creating custom views, and binding shared preferences in a type-safe way. The document encourages exploring how to build type-safe APIs on top of other APIs like bundles and cursors using delegation.
Object Orientation vs Functional Programming in PythonTendayi Mawushe
This document compares and contrasts object-oriented programming and functional programming, and discusses how Python supports both paradigms. It provides examples of common patterns like inheritance, composition, decorators, and callbacks in both styles. The conclusion is that Python facilitates using either paradigm depending on needs, and the two approaches complement each other.
Indexing thousands of writes per second with redispauldix
The document describes using Redis to index thousands of writes per second. Redis can be used to index financial bond data being written at rates of 3,000-5,000 writes per second. It provides examples of storing bond data in Redis hashes and indexing them using Redis sorted sets, lists, and sets to allow retrieving the data based on sorting, pagination, or time ranges. Maintaining the indexes requires periodically trimming old data to control memory usage.
This document appears to be a series of slides from a lightning talk presentation comparing Go and Ruby programming languages. It discusses various differences between the two languages such as Go having static and strict typing while Ruby has dynamic and flexible typing. It also covers topics like memory layout, methods, inheritance between classes, and embedding types in Go. Code examples are provided to illustrate concepts in both languages.
Here is a Python function that calculates the distance between two points given their x and y coordinates:
```python
import math
def distance_between_points(x1, y1, x2, y2):
return math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
```
To use it:
```python
distance = distance_between_points(1, 2, 4, 5)
print(distance)
```
This would print 3.605551275463989, which is the distance between the points (1,2) and (4,5).
The key steps are:
1.
Following a game show format made popular by Joshua Bloch and Neal Gafter's Java Puzzlers this presentation intends to both entertain and inform. Snippets of Python code the whose behaviour is not entirely obvious are shown, the audience will then be asked to pick from a number of options what the behaviour of the program is. The correct and sometimes non-intuitive answer will then be given along with a brief explanation of the idea the puzzle exposes. Only a modest working knowledge of the Python language is required to understand the puzzles, but the puzzles may also entertain the more experienced Python programmer.
In this talk, Adrian Kashivskyy, Netguru iOS Developer, digs into rarely discussed Swift features, such as literal convertibles, interpolation convertibles, pattern matching, reflection and advanced Objective-C bridging.
The document discusses object-oriented programming in Ruby. It introduces some key concepts in OOP like classes, objects, identity, state, and behavior. It also covers Ruby-specific paradigms like modules and mixins. Some common design patterns are mentioned like singleton, iterator, and decorator. The document provides examples to illustrate concepts like inheritance, polymorphism, and visibility in modules.
The document discusses functional programming concepts like the free monad, which represents a computation as an abstract syntax tree (AST) plus an interpreter. A free monad separates the "what" of a computation, expressed as an AST, from the "how", defined by an interpreter. This allows defining reusable computations without tying them to a particular implementation. The free monad is constructed freely from a functor and gives a monad without extra work. It can be used to sequence computations and interpret them in different ways by providing a natural transformation from the functor to a monad.
The document discusses basic inheritance in Python. It explains that all classes inherit from the base Object class. Inheritance allows creating subclasses that inherit attributes and methods from a parent superclass. This allows code reuse and adding specialized behavior. An example creates a Contact class to store names and emails, with a Supplier subclass that adds an "order" method. A SupplierCheck subclass then overrides the order method to check the customer balance before processing orders.
This document provides an agenda and overview for a Python programming training on exception handling, modules, packages, object-oriented programming concepts, and working with databases in Python. The training will cover exception handling syntax, raising exceptions, and try/except blocks. It will also discuss modules, packages, and how to create reusable code. Key object-oriented programming concepts like classes, objects, inheritance, polymorphism, and encapsulation are defined. The document gives examples of connecting to a database and executing SQL statements using the MySQLdb module in Python.
JS Fest 2019. Max Koretskiy. A sneak peek into super optimized code in JS fra...JSFestUA
Very few developers have the need to write super optimized JavaScript code. In application development, we tend to favor readability over optimization. But that’s not the case with frameworks. Developers who use frameworks expect them to run as fast as possible. In fact, speed is often a defining characteristic when choosing a framework. There are techniques that make code run faster. You’ve probably heard about linked lists, monomorphism, and bitmasks, right? Maybe you've even used some. Well, you can find all these and a bunch of other interesting approaches in the sources of most popular JS frameworks.
Over the past year, I’ve seen a lot while reverse-engineering Angular and React. In this talk, I want to share my findings with you. Some of you may end up applying them at work. And others, who knows, may even end up writing the next big framework.
JSUG - Effective Java Puzzlers by Christoph PicklChristoph Pickl
The document summarizes an agenda for a meeting on Effective Java Puzzlers. The agenda includes:
1. Discussing the books Effective Java and Java Puzzlers.
2. Having attendees solve puzzles individually.
3. Going through puzzles together and providing solutions and background information.
4. Sharing good advice on being more effective.
5. Providing a summary of the meeting.
En esta charla veremos con detalle algunas de las construcciones más pythonicas y las posibilidades de expresar de forma clara, concisa y elegante cosas que en otros lenguajes nos obligarían a dar muchos rodeos.
A veces es fácil olvidar algunos recursos como que una función puede devolver varios valores, cómo manipular listas y diccionarios de forma sencilla, contextos, generadores... En esta charla veremos de forma entretenida y práctica cómo mejorar nuestro nivel de Python "nativo".
This document provides an introduction to jRuby, which allows Ruby code to be run on the Java Virtual Machine. It discusses the history and creator of Ruby, Yukihiro "Matz" Matsumoto, and his goals for the language. It then provides a primer on Ruby syntax including booleans, strings, numbers, arrays, hashes, symbols, and classes. It demonstrates how Ruby code can interact with Java code when using jRuby, such as calling Java classes and methods from Ruby. It also discusses metaprogramming in Ruby and how jRuby enables cross-platform GUI development using Java libraries.
EventMachine is a toolkit for building event-driven applications using the reactor pattern. It allows non-blocking I/O and handling of thousands of concurrent connections without threads. EventMachine implements the reactor pattern by having a single-threaded event loop that dispatches incoming events to associated event handlers. This allows highly scalable I/O applications to be written without threads.
Though Language INtegrated Query provides a revolutionary way to write code in C# 3.0 and Visual Basic 9, it is powerless without several enabling language features and libraries. This session will explore the technologies that make LINQ possible and show how you can use the same techniques to make LINQ work for you.
Presented Aug. 28 & 29, 2009 at St. Louis Day of .NET
Value objects express “‘what’ something is rather than ‘who’ or ‘which’ it is.” In other words, values lack identity.
For example, the number 10 or the color red - all instances of 10 are conceptually equal to all other instances of 10, and likewise, red is always red. Two red bikes, however, have distinct identities.
We’ll explore how extracting value objects can simplify the challenge of bringing the real-world to bear as software. Then, we’ll touch on some strategies for integrating value objects with everyone’s favorite ORM, ActiveRecord.
Groovy is a dynamic language for the Java platform that provides features inspired by languages like Python, Ruby and Smalltalk. It allows Java developers to use these features with a syntax that is very similar to Java. Groovy code can be compiled to Java bytecode and integrated with Java applications and libraries. It supports features like closures, metaprogramming, builders and templates to improve developer productivity.
This document provides an overview and introduction to CoffeeScript, a programming language that compiles to JavaScript. It shows how CoffeeScript code compiles to equivalent JavaScript code, and demonstrates CoffeeScript features like functions, classes, and object-oriented programming. The document introduces CoffeeScript syntax for arrays, objects, loops, and functions, and compares syntax to JavaScript. It also covers CoffeeScript concepts like scoping, context, and class-based object-oriented programming using prototypes.
This document discusses Kotlin delegation and how it can be used to extend class behavior without subclassing. It provides examples of external and internal delegation in Kotlin. It also discusses how properties in Kotlin can be delegated to other objects by implementing interfaces like ReadOnlyProperty or using standard delegates from the Kotlin library. Real-world use cases demonstrated include binding views in Android, using dependency injection frameworks like Dagger, creating custom views, and binding shared preferences in a type-safe way. The document encourages exploring how to build type-safe APIs on top of other APIs like bundles and cursors using delegation.
Object Orientation vs Functional Programming in PythonTendayi Mawushe
This document compares and contrasts object-oriented programming and functional programming, and discusses how Python supports both paradigms. It provides examples of common patterns like inheritance, composition, decorators, and callbacks in both styles. The conclusion is that Python facilitates using either paradigm depending on needs, and the two approaches complement each other.
Indexing thousands of writes per second with redispauldix
The document describes using Redis to index thousands of writes per second. Redis can be used to index financial bond data being written at rates of 3,000-5,000 writes per second. It provides examples of storing bond data in Redis hashes and indexing them using Redis sorted sets, lists, and sets to allow retrieving the data based on sorting, pagination, or time ranges. Maintaining the indexes requires periodically trimming old data to control memory usage.
This document appears to be a series of slides from a lightning talk presentation comparing Go and Ruby programming languages. It discusses various differences between the two languages such as Go having static and strict typing while Ruby has dynamic and flexible typing. It also covers topics like memory layout, methods, inheritance between classes, and embedding types in Go. Code examples are provided to illustrate concepts in both languages.
Here is a Python function that calculates the distance between two points given their x and y coordinates:
```python
import math
def distance_between_points(x1, y1, x2, y2):
return math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
```
To use it:
```python
distance = distance_between_points(1, 2, 4, 5)
print(distance)
```
This would print 3.605551275463989, which is the distance between the points (1,2) and (4,5).
The key steps are:
1.
Following a game show format made popular by Joshua Bloch and Neal Gafter's Java Puzzlers this presentation intends to both entertain and inform. Snippets of Python code the whose behaviour is not entirely obvious are shown, the audience will then be asked to pick from a number of options what the behaviour of the program is. The correct and sometimes non-intuitive answer will then be given along with a brief explanation of the idea the puzzle exposes. Only a modest working knowledge of the Python language is required to understand the puzzles, but the puzzles may also entertain the more experienced Python programmer.
In this talk, Adrian Kashivskyy, Netguru iOS Developer, digs into rarely discussed Swift features, such as literal convertibles, interpolation convertibles, pattern matching, reflection and advanced Objective-C bridging.
The document discusses object-oriented programming in Ruby. It introduces some key concepts in OOP like classes, objects, identity, state, and behavior. It also covers Ruby-specific paradigms like modules and mixins. Some common design patterns are mentioned like singleton, iterator, and decorator. The document provides examples to illustrate concepts like inheritance, polymorphism, and visibility in modules.
The document discusses functional programming concepts like the free monad, which represents a computation as an abstract syntax tree (AST) plus an interpreter. A free monad separates the "what" of a computation, expressed as an AST, from the "how", defined by an interpreter. This allows defining reusable computations without tying them to a particular implementation. The free monad is constructed freely from a functor and gives a monad without extra work. It can be used to sequence computations and interpret them in different ways by providing a natural transformation from the functor to a monad.
The document discusses basic inheritance in Python. It explains that all classes inherit from the base Object class. Inheritance allows creating subclasses that inherit attributes and methods from a parent superclass. This allows code reuse and adding specialized behavior. An example creates a Contact class to store names and emails, with a Supplier subclass that adds an "order" method. A SupplierCheck subclass then overrides the order method to check the customer balance before processing orders.
This document provides an agenda and overview for a Python programming training on exception handling, modules, packages, object-oriented programming concepts, and working with databases in Python. The training will cover exception handling syntax, raising exceptions, and try/except blocks. It will also discuss modules, packages, and how to create reusable code. Key object-oriented programming concepts like classes, objects, inheritance, polymorphism, and encapsulation are defined. The document gives examples of connecting to a database and executing SQL statements using the MySQLdb module in Python.
JS Fest 2019. Max Koretskiy. A sneak peek into super optimized code in JS fra...JSFestUA
Very few developers have the need to write super optimized JavaScript code. In application development, we tend to favor readability over optimization. But that’s not the case with frameworks. Developers who use frameworks expect them to run as fast as possible. In fact, speed is often a defining characteristic when choosing a framework. There are techniques that make code run faster. You’ve probably heard about linked lists, monomorphism, and bitmasks, right? Maybe you've even used some. Well, you can find all these and a bunch of other interesting approaches in the sources of most popular JS frameworks.
Over the past year, I’ve seen a lot while reverse-engineering Angular and React. In this talk, I want to share my findings with you. Some of you may end up applying them at work. And others, who knows, may even end up writing the next big framework.
JSUG - Effective Java Puzzlers by Christoph PicklChristoph Pickl
The document summarizes an agenda for a meeting on Effective Java Puzzlers. The agenda includes:
1. Discussing the books Effective Java and Java Puzzlers.
2. Having attendees solve puzzles individually.
3. Going through puzzles together and providing solutions and background information.
4. Sharing good advice on being more effective.
5. Providing a summary of the meeting.
En esta charla veremos con detalle algunas de las construcciones más pythonicas y las posibilidades de expresar de forma clara, concisa y elegante cosas que en otros lenguajes nos obligarían a dar muchos rodeos.
A veces es fácil olvidar algunos recursos como que una función puede devolver varios valores, cómo manipular listas y diccionarios de forma sencilla, contextos, generadores... En esta charla veremos de forma entretenida y práctica cómo mejorar nuestro nivel de Python "nativo".
This document provides an introduction to jRuby, which allows Ruby code to be run on the Java Virtual Machine. It discusses the history and creator of Ruby, Yukihiro "Matz" Matsumoto, and his goals for the language. It then provides a primer on Ruby syntax including booleans, strings, numbers, arrays, hashes, symbols, and classes. It demonstrates how Ruby code can interact with Java code when using jRuby, such as calling Java classes and methods from Ruby. It also discusses metaprogramming in Ruby and how jRuby enables cross-platform GUI development using Java libraries.
EventMachine is a toolkit for building event-driven applications using the reactor pattern. It allows non-blocking I/O and handling of thousands of concurrent connections without threads. EventMachine implements the reactor pattern by having a single-threaded event loop that dispatches incoming events to associated event handlers. This allows highly scalable I/O applications to be written without threads.
Though Language INtegrated Query provides a revolutionary way to write code in C# 3.0 and Visual Basic 9, it is powerless without several enabling language features and libraries. This session will explore the technologies that make LINQ possible and show how you can use the same techniques to make LINQ work for you.
Presented Aug. 28 & 29, 2009 at St. Louis Day of .NET
Value objects express “‘what’ something is rather than ‘who’ or ‘which’ it is.” In other words, values lack identity.
For example, the number 10 or the color red - all instances of 10 are conceptually equal to all other instances of 10, and likewise, red is always red. Two red bikes, however, have distinct identities.
We’ll explore how extracting value objects can simplify the challenge of bringing the real-world to bear as software. Then, we’ll touch on some strategies for integrating value objects with everyone’s favorite ORM, ActiveRecord.
Groovy is a dynamic language for the Java platform that provides features inspired by languages like Python, Ruby and Smalltalk. It allows Java developers to use these features with a syntax that is very similar to Java. Groovy code can be compiled to Java bytecode and integrated with Java applications and libraries. It supports features like closures, metaprogramming, builders and templates to improve developer productivity.
This document provides an overview and introduction to CoffeeScript, a programming language that compiles to JavaScript. It shows how CoffeeScript code compiles to equivalent JavaScript code, and demonstrates CoffeeScript features like functions, classes, and object-oriented programming. The document introduces CoffeeScript syntax for arrays, objects, loops, and functions, and compares syntax to JavaScript. It also covers CoffeeScript concepts like scoping, context, and class-based object-oriented programming using prototypes.
Rails-like JavaScript Using CoffeeScript, Backbone.js and JasmineRaimonds Simanovskis
The document discusses using CoffeeScript to write JavaScript code in a more Ruby-like style. It provides examples of CoffeeScript code for functions, objects, classes, and other concepts. CoffeeScript allows JavaScript code to be written in a cleaner syntax that resembles Ruby. This helps address problems with JavaScript code appearing "ugly" and unfamiliar to developers experienced in Ruby. CoffeeScript transpires to regular JavaScript, enabling the Ruby-like code to run in browsers.
The document appears to be a series of tips for writing clean, readable code in Groovy. Some of the key points mentioned include:
1. Write readable code and comment any tricks or non-obvious parts of the code.
2. Be aware that some clever code may actually be a bug.
3. Use static code analysis tools like IntelliJ IDEA to inspect code quality.
4. Refer to documentation when unsure rather than relying on tricks.
5. Avoid writing code in an overly clever or obfuscated way.
The document provides an overview of the Ruby programming language with sections on installation, data types, operators, control structures, methods, classes and modules. It discusses key aspects of Ruby like its object oriented nature, dynamic typing, syntax and cross-platform capabilities. The document serves as a quick tour of the Ruby language covering its basic concepts, structures and features.
The document discusses Groovy concepts including types, operators, objects, structures, closures, control structures, and methods for strings, lists, and maps. It covers topics such as optional syntax, imports, type checking, numbers, strings, GStrings, lists, maps, enums, operators, date/time operations, and closure usage including delegation and implicit parameters. Groovy allows for optional syntax elements, dynamic typing, closures, and methods to operate on common data types like strings, lists, and maps.
This document provides 7 habits for writing more functional Swift code. It discusses avoiding mutability and for-loops in favor of map, filter and reduce functions. It also covers being lazy, currying functions, writing domain-specific languages, and thinking about code in terms of data and functions rather than objects.
Desarrollando aplicaciones web en minutosEdgar Suarez
This document provides an overview of the Ruby programming language, including:
- Its creation by Yukihiro Matsumoto in 1993 and key influences like Perl, Smalltalk, and Lisp.
- Its main features like dynamic typing, duck typing, readable syntax, metaprogramming capabilities, blocks, exceptions, and object orientation.
- How Ruby on Rails was created by David Heinemeier Hansson in 2004 to build web applications using Ruby.
- Common tasks when using Ruby like installing Ruby and Rails, generating models and migrations, associations, validations, and using the MVC framework.
Ruby is an object-oriented scripting language that is dynamically typed and supports duck typing. It was created in the 1990s by Yukihiro "Matz" Matsumoto and has gained popularity through its use in web frameworks like Ruby on Rails. This document provides an overview of the Ruby language, including its history, basic syntax like strings and methods, core data types, control structures, classes and inheritance. It also discusses tools used by Ruby developers like RubyGems, interactive Ruby shells, and practical applications of Ruby for web development, testing, and automation through scripting. Finally, it mentions the international Ruby community and local user groups.
This document provides an overview of the Ruby programming language. It discusses what Ruby is, who uses it, and rumors about it. It then covers why Ruby is used, how it compares to other languages like Java and PHP, its core features and idioms. The document also provides code examples demonstrating Ruby's classes, loops, exceptions, lambdas/procs and more. It concludes by discussing Ruby gems, frameworks like Ruby on Rails, and resources for learning Ruby like IRB, Try Ruby, Codecademy and Bloc's Ruby Warrior.
This document provides an overview of the Ruby programming language. It discusses Ruby's history, design, syntax features like classes, modules, blocks, and metaprogramming. It also covers Ruby implementations like MRI, JRuby, REE, and others. In 3 sentences:
Ruby is a dynamic, reflective, object-oriented scripting language created in the mid-1990s by Yukihiro Matsumoto. It supports features like classes, modules, blocks and closures, duck typing, and metaprogramming. Popular Ruby implementations include MRI, JRuby, REE, and others that provide the Ruby language on different platforms and virtual machines.
This document provides an overview of the Ruby programming language. It discusses Ruby's clean and meaningful syntax, everything being an object, dynamic typing and duck typing, open classes, blocks, mixins, testing, standard library, and gems. Ruby aims to be productive and fun to use.
A linguagem de programação Ruby - Robson "Duda" Sejan Soares DornellesTchelinux
Sobre o palestrante: Formado na UFPel no início do ano corrente, trabalhou com desenvolvimento de hardware para TV digital durante a graduação. Entretanto, sempre foi apaixonado por belas linguagens de programação, e destas, Ruby é a que mais se destaca. Atualmente aguarda o mês de junho, quando começa a trabalhar na ThoughtWorks, em Porto Alegre.
Ruby provides various ways to define and manipulate methods. Methods can be defined on classes, objects, and singleton classes. Singleton classes allow defining methods that are only available to a specific object. Ruby also supports currying methods to return procs that can later be called. Methods can be aliased, undefined, or dynamically defined/manipulated at runtime using techniques like eval, instance_eval, and reflection. Classes in Ruby are also objects that can have singleton classes and methods defined on them.
Similar to Lecture on Rubinius for Compiler Construction at University of Twente (20)
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfMalak Abu Hammad
Discover how MongoDB Atlas and vector search technology can revolutionize your application's search capabilities. This comprehensive presentation covers:
* What is Vector Search?
* Importance and benefits of vector search
* Practical use cases across various industries
* Step-by-step implementation guide
* Live demos with code snippets
* Enhancing LLM capabilities with vector search
* Best practices and optimization strategies
Perfect for developers, AI enthusiasts, and tech leaders. Learn how to leverage MongoDB Atlas to deliver highly relevant, context-aware search results, transforming your data retrieval process. Stay ahead in tech innovation and maximize the potential of your applications.
#MongoDB #VectorSearch #AI #SemanticSearch #TechInnovation #DataScience #LLM #MachineLearning #SearchTechnology
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Speck&Tech
ABSTRACT: A prima vista, un mattoncino Lego e la backdoor XZ potrebbero avere in comune il fatto di essere entrambi blocchi di costruzione, o dipendenze di progetti creativi e software. La realtà è che un mattoncino Lego e il caso della backdoor XZ hanno molto di più di tutto ciò in comune.
Partecipate alla presentazione per immergervi in una storia di interoperabilità, standard e formati aperti, per poi discutere del ruolo importante che i contributori hanno in una comunità open source sostenibile.
BIO: Sostenitrice del software libero e dei formati standard e aperti. È stata un membro attivo dei progetti Fedora e openSUSE e ha co-fondato l'Associazione LibreItalia dove è stata coinvolta in diversi eventi, migrazioni e formazione relativi a LibreOffice. In precedenza ha lavorato a migrazioni e corsi di formazione su LibreOffice per diverse amministrazioni pubbliche e privati. Da gennaio 2020 lavora in SUSE come Software Release Engineer per Uyuni e SUSE Manager e quando non segue la sua passione per i computer e per Geeko coltiva la sua curiosità per l'astronomia (da cui deriva il suo nickname deneb_alpha).
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
Full-RAG: A modern architecture for hyper-personalizationZilliz
Mike Del Balso, CEO & Co-Founder at Tecton, presents "Full RAG," a novel approach to AI recommendation systems, aiming to push beyond the limitations of traditional models through a deep integration of contextual insights and real-time data, leveraging the Retrieval-Augmented Generation architecture. This talk will outline Full RAG's potential to significantly enhance personalization, address engineering challenges such as data management and model training, and introduce data enrichment with reranking as a key solution. Attendees will gain crucial insights into the importance of hyperpersonalization in AI, the capabilities of Full RAG for advanced personalization, and strategies for managing complex data integrations for deploying cutting-edge AI solutions.
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
21. 0000: meta_push_0
0001: set_local 0 # i
0003: pop
0004: push_local 0 # i
0006: push_literal 1000
0008: meta_send_op_lt :<
0010: goto_if_false 23
i = 0
0012: push_local 0 # i
while i < 1000 do 0014: meta_push_1
i = i + 1 0015: meta_send_op_plus :+
0017: set_local 0 # i
end 0019: pop
0020: check_interrupts
0021: goto 4
0023: push_nil
0024: pop
0025: push_true
0026: ret
22. Fancy
class Person {
read_write_slots: ['name, 'age, 'city]
def initialize: @name age: @age city: @city {
}
def go_to: city {
if: (city is_a?: City) then: {
@city = city
}
}
def to_s {
"Person: #{@name}, #{@age} years old, living in #{@city}"
}
}
29. def each
return to_enum(:each) unless block_given?
i = @start
total = i + @total
tuple = @tuple
while i < total
yield tuple.at(i)
i += 1
end
self
end
33. class FixnumLiteral < NumberLiteral
def initialize(line, value)
@line = line
@value = value
end
def bytecode(g)
pos(g)
g.push @value
end
def defined(g)
g.push_literal "expression"
end
end
44. module Named
def name
class Person
"named"
def name
end
"me"
end
end
class Person
end
include Named
end
45. module Named
def name class Person
class Person
"named" end
def name
end
"me"
end def p.name
end
class Person "specific"
end
include Named end
end
46. class Person
attr_accessor :name
end
10000.times do
p = Person.new
p.name
end
47. There are only two hard
problems in Computer Science:
cache invalidation,
naming things
and off-by-one errors
48.
49. module Naming
def name
"me2"
end
end
class Person
include Naming
end
10000.times do
p = Person.new
p.name
end
50. module Naming
def name
"me2" class Person
end def name
end "new_name"
end
class Person end
include Naming
end 10000.times do
p = Person.new
10000.times do p.name
p = Person.new end
p.name
end
53. “...we finally managed to get our Linux (...) builds to use
GCC 4.5, ... and profile guided optimization enabled”
Mike Hommey - on Firefox 6 performance
54. def method1
1 + 1
end
def method2
2 + 1
end
10000.times do
method1
end
65. array = [1] * 1000000
array.each do |element|
puts "element: #{element}"
end
66.
67. def method1
1 + 1
end
def method2
method1
end
100.times do
method2
end
68. def method1 def method1
1 + 1 1 + 1
end end
def method2 def method2
method1 method1
end end
100.times do 100.times do
method2 method1
end end
69. def method1 def method1
1 + 1 1 + 1
end end
def method2 def method2
method1 method1
end end
100.times do 100.times do
method2 method1
end end
70. def method1 def method1 def method1
1 + 1 1 + 1 1 + 1
end end end
def method2 def method2 def method2
method1 method1 method1
end end end
100.times do 100.times do 100.times do
method2 method1 1 + 1
end end end
71. def method1 def method1 def method1
1 + 1 1 + 1 1 + 1
end end end
def method2 def method2 def method2
method1 method1 method1
end end end
100.times do 100.times do 100.times do
method2 method1 1 + 1
end end end
72.
73. def awesome(x)
return 0 if x == 0
x + 1
end
def use_awesomeness_regular
a = awesome(0)
b = awesome(1)
a + b
end
74. def use_awesomeness_inlined
a = begin
return 0 if 0 == 0
0 + 1
end
b = begin
return 1 if 1 == 0
1 + 1
end
a + b
end
75.
76. array = [1] * 1000000
array.each do |element|
puts "element: #{element}"
end
77. array = [1] * 1000000
array = [1] * 1000000
i = 0
size = array.size
array.each do |element|
while i < size
puts "element: #{element}"
puts "element: #{array[i]}"
end
i += 1
end
78. array = [1] * 1000000
array = [1] * 1000000
i = 0
array.each do |element|
puts "element: #{element}"
== size = array.size
while i < size
puts "element: #{array[i]}"
end
i += 1
end
79.
80. array = [1] * 100
array.each do |element|
puts "element: #{element}"
b = 2
end
puts b
81. array = [1] * 100
array = [1] * 100
i = 0
size = array.size
array.each do |element|
while i < size
puts "element: #{element}"
puts "element: #{array[i]}"
b = 2
b = 2
end
i += 1
end
puts b
puts b
82. array = [1] * 100
array = [1] * 100
i = 0
size = array.size
array.each do |element|
while i < size
puts "element: #{element}"
b = 2 != puts "element: #{array[i]}"
b = 2
end
i += 1
end
puts b
puts b
Regular contributor since the early beginnings of 2008\n
First I want to explain two concepts\nThe first concept is about dynamic versus static languages.\n\n- Dynamic languages\nTypes checking is done at runtime\n- Static languages\nTypes are checked during compile time\n\n \n
The first is what happens in a dynamic language. Types are not fixed and you can use different types if you want\nThe second is a static language. Once a certain type is defined, the type can&#x2019;t be changed. \n
Another difference is how types are enforced.\nThis is often confused with static and dynamic languages, seeing the dynamic language as weakly typed. This however is often not true.\n\n-Strong typing\nThis enforces specific rules and behavior on what happens when you run certain operations on differently typed objects\n-Weak typing\nImplicit type conversion when different types are used\n\n
\n
So what is Ruby?\n\nRuby is a dynamically strongly typed language. So you don&#x2019;t specify types when writing ruby code, but during runtime it&#x2019;s types are not just changed automatically.\n\nIt has primarily been influenced by Perl, Smalltalk and Lisp. The primary design philosophy is that a language should be productive and fun to use. \n
So how does it look?\nThe classic Hello world! example\n
This is how basic class definition and method definition look like\n
Block syntax. They are lambda like constructs. It&#x2019;s like passing a piece of code as a special argument to a method. \n
Modules. They allow for code being mixed into other classes. It&#x2019;s a bit like multiple inheritance. This is made possible because of the dynamic nature of Ruby\n
Rubinius includes everything needed to run Ruby code\n
That means it includes a bytecode Virtual Machine, primarily designed for running Ruby code.\n
But it also includes all core classes etc. you expect in Ruby, like String, Hash and Array. In other languages t&#x2019;s often called the standard library, but that has a different meaning in Ruby, so hence this name. \n
It was started in 2006, thought up by Evan Phoenix during his honeymoon. He and Brian Ford are payed full time to work on Rubinius.\n
So what does the virtual machine entail? \n
The first and initial version was written in Ruby. After this proof of concept, a first version of the virtual machine was written C. In 2008 the choice was made to rewrite it in C++, because that is a better fit with the architecture of the VM. \n
The bytecode instruction set includes the necessary instructions for running Ruby code efficiently. This doesn&#x2019;t mean other languages can&#x2019;t be written on top of Rubinius.\n
So what does the bytecode look like?\nThe comments at the end show how the variable names are mapped to slots\n
One example is Fancy. It has a few different aspect compare to ruby, like named parameters\n
There&#x2019;s a bunch of other languages people created, mostly as an experiment and not very mature\n
There&#x2019;s a bunch of other languages people created, mostly as an experiment and not very mature\n
There&#x2019;s a bunch of other languages people created, mostly as an experiment and not very mature\n
So how do we make it fast? There&#x2019;s quite a few techniques for that which will be discussed later in the lecture\n
The kernel code is written in Ruby as much as possible. This means that classes like String, Hash and Array are written in Ruby itself\n
This is how Array#each looks like. It uses a Tuple, which is a fixed size array like structure that Array is built upon. Hash is written in Ruby too\n
Having more in Ruby also means that it&#x2019;s easier for people to help out with. You don&#x2019;t need to know C / C++ in order to contribute to Rubinius\n
\n
\n
It parses into an AST and then outputs bytecode by walking the AST. Each node knows how to emit bytecode, such as this example for Fixnum literals. It stores the line number and the given value for the literal.\n
People often claim that Ruby, or dynamic languages in general are slow. \n
\n
Add a method useful for you on a core type. Not always the best solution, but it&#x2019;s a very flexible way to handle things. \n
You can also do very nasty things.\n
\n
\n
So in order to improve performance of a dynamic language, there are various techniques. One of the most basic ones that gives an easy improvement is inline caching.\n
So we have this little piece of code. First, we create a Person, then we do some other stuff and then we call the method name on it. p.name here is know as a call site.\n
So where can this method be?\n- There&#x2019;s the simple case of it being a method defined for all instances of the class\n-It can also be in a module included into the class\n-Another option is defining a method on the metaclass of the object. This means it&#x2019;s only available for this specific instance of the Person.\n
So where can this method be?\n- There&#x2019;s the simple case of it being a method defined for all instances of the class\n-It can also be in a module included into the class\n-Another option is defining a method on the metaclass of the object. This means it&#x2019;s only available for this specific instance of the Person.\n
So where can this method be?\n- There&#x2019;s the simple case of it being a method defined for all instances of the class\n-It can also be in a module included into the class\n-Another option is defining a method on the metaclass of the object. This means it&#x2019;s only available for this specific instance of the Person.\n
So consider this extended example with complete code. If you look at the code, you see that when running this, p.name ends up in the same method every time you execute the code. So even though Ruby is very dynamic, most of the code looks like it&#x2019;s static anyway. \n\nSo the expensive computation can perhaps be stored and reused so it&#x2019;s not needed each time. The caching of this method dispatch result is called inline caching.\n
\n
So, here we need to be sure to invalidate our cache, otherwise it would run the wrong method\n
So, here we need to be sure to invalidate our cache, otherwise it would run the wrong method\n
So, now the question is, is this lookup changed too? The problem is that we want to keep the caches simple. So there&#x2019;s a cache entry at each call site that stores for a specific type, the method it dispatched to and module that method is defined. This makes the cache entries small so there&#x2019;s isn&#x2019;t a lot of memory overhead.\n\n\nSo we don&#x2019;t want to store the complete chain. Which means that we only have OtherObject as a type stored here. It also means that we need to invalidate the cache because we don&#x2019;t know whether OtherObject includes Naming or not. \n\nTherefore invalidating caches is a brute force measure that removes all caches with the same name, so in this case &#x201C;name&#x201D;.\n
Just In Time compilation means that code is compiled to native code during execution of your programs. \n
This quote shows that using runtime information, you can optimize code a lot better than just only ahead of time. \n\nSo we need to track this runtime information so we know what we can compile into native code. \n
So here we have a bunch of code that is executed quite often. We don&#x2019;t know ahead of time that we don&#x2019;t actually need the method2 method, but we do during runtime. So we can use this information at runtime.\n
Each VMMethod object keeps track of various things\nYou can see how often a method is called\nThe llvm_function_ pointer points at jitted code for this method\nThere&#x2019;s a name for the method of course\nAnd a whole bunch of other stuff removed here\n
So right now, a method is going to be compiled after it has been executed 4000 times. \n
The initial version used hand crafted assembly to output the code for it. This was cumbersome and would need a lot of work to optimize it to a decently performing level. \n
That&#x2019;s why the LLVM compiler infrastructure was chosen. It already did a huge amount of legwork in generating good native code for various platforms. \n
\n
This is what the LLVM bytecode looks like without any optimizations. This is actually kind of like how with Rubinius code is translated. There is a C++ API for creating this bytecode. \n
This is what the LLVM optimizer makes out of it. It can reason about so in the end the value 10 can be returned directly. LLVM can run similar passes over code generated through the C++ API. \n
So how is this implemented? The code compilation actually happens in a background thread. The virtual machine requests that a certain method is jitted, which is then given to the LLVM thread. The LLVM thread then goes to work and creates the LLVM bytecode. After this is compiled, it sets the llvm_function_ pointer seen earlier. \n\nThis means that the VM just runs along nicely without being interrupted by the compilation of code. \n
\n
No overhead is faster than no overhead. We already saw that inline caches can greatly improve method dispatching, but there&#x2019;s certainly room for even more optimizations. One of these is code inlining, which means that method dispatch overhead is completely removed. \n\n\n
Ruby has another place that can benefit greatly from code inline, which is the usage of blocks. A block is a construct which has it&#x2019;s own scope and can also be captured explicitly. This means that it does add overhead and looking at removing that overhead is very interesting. \n
So we start here with a simple piece of code. What inlining does, is moving the actual code of the method into the method that the method is called from. So this means that instead of dispatching a method, it executes the code of that method directly. \n
So we start here with a simple piece of code. What inlining does, is moving the actual code of the method into the method that the method is called from. So this means that instead of dispatching a method, it executes the code of that method directly. \n
So we start here with a simple piece of code. What inlining does, is moving the actual code of the method into the method that the method is called from. So this means that instead of dispatching a method, it executes the code of that method directly. \n
So we start here with a simple piece of code. What inlining does, is moving the actual code of the method into the method that the method is called from. So this means that instead of dispatching a method, it executes the code of that method directly. \n
So we start here with a simple piece of code. What inlining does, is moving the actual code of the method into the method that the method is called from. So this means that instead of dispatching a method, it executes the code of that method directly. \n
So inline has some great potential, but there are quite a few caveats. \n
We take a look at this example. Here is the same method called with a different parameter, which we could perhaps inline. So we take a naive attempt in the next slide.\n
Here we manually inlined the two calls to awesome() and injected the code in this place. The begin / end block is used so we have the correct scope of the inlined code.\n\nBut if we look at this, this code behaves differently! Let me show this by running it. What you can see here is that the control flow is different because of the return. While the return first meant that it would return from the method, with the inlining this method is no longer present. So when inlining, control flow is something that needs considering. \n
This is a very simple example of how block code inlining should work. The left version is a much prettier and nicer version and that is how Ruby code should look.\n\nThe example on the right is equivalent, but it has the block used in the version on the left removed. This is what you can call block inlining in Rubinius. \n
This is a very simple example of how block code inlining should work. The left version is a much prettier and nicer version and that is how Ruby code should look.\n\nThe example on the right is equivalent, but it has the block used in the version on the left removed. This is what you can call block inlining in Rubinius. \n
This is a very simple example of how block code inlining should work. The left version is a much prettier and nicer version and that is how Ruby code should look.\n\nThe example on the right is equivalent, but it has the block used in the version on the left removed. This is what you can call block inlining in Rubinius. \n
But beware with scoping issues. Who thinks he knows what happens here?\n
But beware with scoping issues. Who thinks he knows what happens here?\n
But beware with scoping issues. Who thinks he knows what happens here?\n
So there are few reasons why code isn&#x2019;t inlined. These properties can be determined by analyzing the bytecode for a method. If these issues come forth from it, the code isn&#x2019;t inlined. What can be inlined is something that is improved over time. More code can be written to support more complex structures for inlining. \n
So there are few reasons why code isn&#x2019;t inlined. These properties can be determined by analyzing the bytecode for a method. If these issues come forth from it, the code isn&#x2019;t inlined. What can be inlined is something that is improved over time. More code can be written to support more complex structures for inlining. \n
So there are few reasons why code isn&#x2019;t inlined. These properties can be determined by analyzing the bytecode for a method. If these issues come forth from it, the code isn&#x2019;t inlined. What can be inlined is something that is improved over time. More code can be written to support more complex structures for inlining. \n
\n
People are really happy that others clean up their garbage. No need to worry about it anymore. Using automatic memory management has various advantages, such as not having to worry about object ownership, double free bugs and possible memory leaks. \n\nRuby also uses automatic memory management and needs garbage collection.\n
A simple naive way of doing garbage collection is to start at the root of the object graph and go from there. Going through each object, marking the objects as you go along. After this marking phase, you go through all objects again. Everything that doesn&#x2019;t have a mark set, is freed as it is apparently not reachable anymore. \n
So how can we make this faster? We can look at the properties of different objects. Young objects are often only around for a very short time. So we want to have a mechanism to suit this properly. \n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Immix uses different block of memory. It allocates objects in a block, so it has contiguous allocation for objects. This means it doesn&#x2019;t need a free list for allocation. On the other hand, this technique can limit memory fragmentation.\n
Immix uses different block of memory. It allocates objects in a block, so it has contiguous allocation for objects. This means it doesn&#x2019;t need a free list for allocation. On the other hand, this technique can limit memory fragmentation.\n
Immix uses different block of memory. It allocates objects in a block, so it has contiguous allocation for objects. This means it doesn&#x2019;t need a free list for allocation. On the other hand, this technique can limit memory fragmentation.\n
Very large objects are directly allocated in a special area. This is because you don&#x2019;t want to copy them, since copying is an expensive operation and they also don&#x2019;t fit in the immix blocks. \n\nThis special area doesn&#x2019;t copy objects, but just uses a very simple mark and sweep algorithm.\n
\n
This is kind of how an object looks like in memory. By default there&#x2019;s an instance variable table, because you can add and remove instance variables on the fly in Ruby. There&#x2019;s no definitive way to know which instance variable we need up front.\n\nBut we can make a very nice educated guess on how it would look like. We use the compiler to track all the variables we see. So if we compile the class given here, we can track all instance variables we encounter. \n
Here we see the effect on memory usage. With the instance variable table, it uses 160 bytes for each object of type Address, but with the packing it only uses 56 bytes!\n
\n
So if you want to know more, please look it up here. You can also of course ask me additional questions. \n
If you think it&#x2019;s interesting and want to contribute, just one patch accepted means commit access. \n