The document discusses benchmarking and profiling in Elixir. It begins with an introduction to Elixir and some of its common uses like web applications. It then covers topics like what benchmarking is, different types of benchmarks, and tools for benchmarking in Elixir. An example is provided benchmarking tail call optimization by comparing recursive and iterative sum functions. The document ends by discussing parallelism benchmarks and noting that benchmarks may not represent real user performance.
An enhanced version of the #codemesh2014 talk on network programming in Go. It covers HTTP, HTTPS, TCP/IP, TCP/IP over TLS, UDP and basic cryptographic functions with AES-CBC and RSA.
A tour of Python: slides from presentation given in 2012.
[Some slides are not properly rendered in SlideShare: the original is still available at http://www.aleksa.org/2015/04/python-presentation_7.html.]
An enhanced version of the #codemesh2014 talk on network programming in Go. It covers HTTP, HTTPS, TCP/IP, TCP/IP over TLS, UDP and basic cryptographic functions with AES-CBC and RSA.
A tour of Python: slides from presentation given in 2012.
[Some slides are not properly rendered in SlideShare: the original is still available at http://www.aleksa.org/2015/04/python-presentation_7.html.]
An introduction to Go from basics to web through the lens of "Hello World", extracted from the Book "A Go Developer's Notebook" available from http://leanpub.com/GoNotebook
Find out about hardware, software, protocols, digital video broadcasting, video formats, computer architectures, Perl modules and more as the speaker undertakes the project of a lifetime in his living room: fewer cables.
Follow me on Twitter at http://www.twitter.com/cballou or checkout my startup at http://www.pop.co.
In this presentation we will cover the best features and additions in PHP 5.5. You can look forward to the following:
* Support for generators has been added via the yield keyword
* Usage of the new finally keyword in try-catch blocks
* An overview and examples of the new password hashing API
* The foreach control structure now supports unpacking nested arrays into separate variables via the list() construct
* empty() supports arbitrary expressions such as closures returning false
* array and string literal dereferencing
* The Zend Optimiser+ opcode cache (via the new OPcache extension)
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQAFest
Our daily work is comprised of testing a product and improve its quality. However, here and there, we can come to a state where we find a need to build a tool, that can make our work easierbetter.
I will share from my experience when I found myself in a situation where building a tool was needed.
We will start with a web application that allows you to know when a food delivery you ordered arrives to the office, and then we will focus on a tool that test the performance of an app from the UI side. We will do a live demo for both of them.
Functional programming languages promise to be easier to test and easier to debug. However, when learning the functional way we often try to translate our current techniques to another language. This is usually not easy and the end result is far from those promises we've heard. Early frustrations might even discourage from further learning.
In this talk I will show you two very simple patterns:
- Designing code around single data structure
- Dealing with impure parts of program like DBs, external services or IO
This should give beginners jump start for their first toy projects and further exploration.
An introduction to Go from basics to web through the lens of "Hello World", extracted from the Book "A Go Developer's Notebook" available from http://leanpub.com/GoNotebook
Find out about hardware, software, protocols, digital video broadcasting, video formats, computer architectures, Perl modules and more as the speaker undertakes the project of a lifetime in his living room: fewer cables.
Follow me on Twitter at http://www.twitter.com/cballou or checkout my startup at http://www.pop.co.
In this presentation we will cover the best features and additions in PHP 5.5. You can look forward to the following:
* Support for generators has been added via the yield keyword
* Usage of the new finally keyword in try-catch blocks
* An overview and examples of the new password hashing API
* The foreach control structure now supports unpacking nested arrays into separate variables via the list() construct
* empty() supports arbitrary expressions such as closures returning false
* array and string literal dereferencing
* The Zend Optimiser+ opcode cache (via the new OPcache extension)
QA Fest 2019. Saar Rachamim. Developing Tools, While TestingQAFest
Our daily work is comprised of testing a product and improve its quality. However, here and there, we can come to a state where we find a need to build a tool, that can make our work easierbetter.
I will share from my experience when I found myself in a situation where building a tool was needed.
We will start with a web application that allows you to know when a food delivery you ordered arrives to the office, and then we will focus on a tool that test the performance of an app from the UI side. We will do a live demo for both of them.
Functional programming languages promise to be easier to test and easier to debug. However, when learning the functional way we often try to translate our current techniques to another language. This is usually not easy and the end result is far from those promises we've heard. Early frustrations might even discourage from further learning.
In this talk I will show you two very simple patterns:
- Designing code around single data structure
- Dealing with impure parts of program like DBs, external services or IO
This should give beginners jump start for their first toy projects and further exploration.
Developer Experience i TypeScript. Najbardziej ikoniczne duoThe Software House
Wiktor Toporek: TypeScript bez wątpienia jest obecnie pewnym standardem wśród obecnych rozwiązań powstałych w JavaScripcie. Ale czy poza byciem dodatkiem który uzupełnia odrobinę dokumentacje i deklaruje kontrakt jakiego typu parametry przyjmują i zwracają np. funkcje jakiejś biblioteki, można wycisnąć z niego coś więcej? Podczas prezentacji wykorzystamy TypeScript do granic możliwości, używając zaawansowanych technik które sprawiają że interfejs naszego API będzie sam kierował używających go developerów na drogę poprawnego użycia, które jest zgodne z naszymi (twórców) założeniami, poprawiając tym samym ich doświadczenia.
How to add an interactive shell (remote, too) to a C++ application by using my open-source C++14 library:
https://github.com/daniele77/cli
In the slide deck you can learn how to use it, how does it work, and find some thoughts about C++ design and patterns used by the library.
3 things you must know to think reactive - Geecon Kraków 2015Manuel Bernhardt
Over the past few years, web-applications have started to play an increasingly important role in our lives. We expect them to be always available and the data to be always fresh. This shift into the realm of real-time data processing is now transitioning to physical devices, and Gartner predicts that the Internet of Things will grow to an installed base of 26 billion units by 2020.
As reactive architectures gain in popularity, more and more developers find themselves faced with the challenge of "thinking reactive". To leave behind the well-known concepts of mutable, object-oriented, imperative and synchronous programming in favour of immutable, functional, declarative and asynchronous programming requires quite a mind shift and it isn't obvious to take the plunge.
In this talk we will explore three concepts from the world of functional programming that are at the core of building reactive applications: immutability, higher-order functions and manipulating immutable collections. We will first see how the "traditional" mutable, object-oriented approach of doing things can be problematic when it comes to multi-core programming, and then how to apply them to asynchronous systems.
Did you know that Python preallocates integers from -5 to 257? Reusing them 1000 times, instead of allocating memory for a bigger integer, can save you a couple milliseconds of code’s execution time. If you want to learn more about this kind of optimizations then, … well, probably this presentation is not for you :) Instead of going into such small details, I will talk about more “sane” ideas for writing faster code.
After a brief overview of how you can speed up your Python code in general, we will dig into source code optimization. I will show you some simple and fast ways of measuring the execution time of your code, and then we will discuss examples of how to improve some common code structures.
You will see:
* The fastest way of removing duplicates from a list
* How much faster your code is when you reuse the built-in functions instead of trying to reinvent the wheel
* What is faster than the “for loop”
* If the lookup is faster in a list or a set
* When it’s better to beg for forgiveness than to ask for permission
Python's "batteries included" philosophy means that it comes with an astonishing amount of great stuff. On top of that, there's a vibrant world of third-party libraries that help make Python even more wonderful. We'll go on a breezy, example-filled tour through some of my favorites, from treasures in the standard library to great third-party packages that I don't think I could live without, and we'll touch on some of the fuzzier aspects of the Python culture that make it such a joy to be part of.
Elixir & Phoenix - fast, concurrent and explicitTobias Pfeiffer
Elixir and Phoenix are all the hype lately - what's great about them? Is there more to them than "just" fast, concurrent and reliable?
This talk will give a short intro into both Elixir and Phoenix, highlighting strengths, differences from Ruby/Rails and weaknesses.
Similar to FPBrno 2018-05-22: Benchmarking in elixir (20)
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteGoogle
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
👉👉 Click Here To Get More Info 👇👇
https://sumonreview.com/ai-pilot-review/
AI Pilot Review: Key Features
✅Deploy AI expert bots in Any Niche With Just A Click
✅With one keyword, generate complete funnels, websites, landing pages, and more.
✅More than 85 AI features are included in the AI pilot.
✅No setup or configuration; use your voice (like Siri) to do whatever you want.
✅You Can Use AI Pilot To Create your version of AI Pilot And Charge People For It…
✅ZERO Manual Work With AI Pilot. Never write, Design, Or Code Again.
✅ZERO Limits On Features Or Usages
✅Use Our AI-powered Traffic To Get Hundreds Of Customers
✅No Complicated Setup: Get Up And Running In 2 Minutes
✅99.99% Up-Time Guaranteed
✅30 Days Money-Back Guarantee
✅ZERO Upfront Cost
See My Other Reviews Article:
(1) TubeTrivia AI Review: https://sumonreview.com/tubetrivia-ai-review
(2) SocioWave Review: https://sumonreview.com/sociowave-review
(3) AI Partner & Profit Review: https://sumonreview.com/ai-partner-profit-review
(4) AI Ebook Suite Review: https://sumonreview.com/ai-ebook-suite-review
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Unleash Unlimited Potential with One-Time Purchase
BoxLang is more than just a language; it's a community. By choosing a Visionary License, you're not just investing in your success, you're actively contributing to the ongoing development and support of BoxLang.
How to Position Your Globus Data Portal for Success Ten Good PracticesGlobus
Science gateways allow science and engineering communities to access shared data, software, computing services, and instruments. Science gateways have gained a lot of traction in the last twenty years, as evidenced by projects such as the Science Gateways Community Institute (SGCI) and the Center of Excellence on Science Gateways (SGX3) in the US, The Australian Research Data Commons (ARDC) and its platforms in Australia, and the projects around Virtual Research Environments in Europe. A few mature frameworks have evolved with their different strengths and foci and have been taken up by a larger community such as the Globus Data Portal, Hubzero, Tapis, and Galaxy. However, even when gateways are built on successful frameworks, they continue to face the challenges of ongoing maintenance costs and how to meet the ever-expanding needs of the community they serve with enhanced features. It is not uncommon that gateways with compelling use cases are nonetheless unable to get past the prototype phase and become a full production service, or if they do, they don't survive more than a couple of years. While there is no guaranteed pathway to success, it seems likely that for any gateway there is a need for a strong community and/or solid funding streams to create and sustain its success. With over twenty years of examples to draw from, this presentation goes into detail for ten factors common to successful and enduring gateways that effectively serve as best practices for any new or developing gateway.
10. Sum recursion - No Tail Call Optimization
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
11. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
12. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + sum_no_tco([2, 3, 4])
13. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + sum_no_tco([2, 3, 4])
+ 2 + sum_no_tco([3, 4])
14. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + sum_no_tco([2, 3, 4])
+ 2 + sum_no_tco([3, 4])
+ 3 + sum_no_tco([4])
15. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + sum_no_tco([2, 3, 4])
+ 2 + sum_no_tco([3, 4])
+ 3 + sum_no_tco([4])
+ 4 + sum_no_tco([])
16. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + sum_no_tco([2, 3, 4])
+ 2 + sum_no_tco([3, 4])
+ 3 + sum_no_tco([4])
+ 4 + sum_no_tco([])
+ 0
17. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + sum_no_tco([2, 3, 4])
+ 2 + sum_no_tco([3, 4])
+ 3 + sum_no_tco([4])
+ 4 + 0
18. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + sum_no_tco([2, 3, 4])
+ 2 + sum_no_tco([3, 4])
+ 3 + 4
19. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + sum_no_tco([2, 3, 4])
+ 2 + 7
20. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
1 + 9
21. Sum function - Without Tail Call
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
NoTCO.sum_no_tco([1, 2, 3, 4])
= 10
22. Sum function - Tail Call Optimization
defmodule TCO do
def sum([], acc), do: acc
def sum([head | tail], acc) do
sum(tail, head + acc)
end
end
23. Sum function - Tail Call Optimization
defmodule TCO do
def sum([], acc), do: acc
def sum([head | tail], acc) do
sum(tail, head + acc)
end
end
TCO.sum([1, 2, 3, 4], 0)
24. Sum function - Tail Call Optimization
defmodule TCO do
def sum([], acc), do: acc
def sum([head | tail], acc) do
sum(tail, head + acc)
end
end
TCO.sum([1, 2, 3, 4], 0)
sum([2, 3, 4], 1)
25. Sum function - Tail Call Optimization
defmodule TCO do
def sum([], acc), do: acc
def sum([head | tail], acc) do
sum(tail, head + acc)
end
end
TCO.sum([1, 2, 3, 4], 0)
sum([3, 4], 3)
26. Sum function - Tail Call Optimization
defmodule TCO do
def sum([], acc), do: acc
def sum([head | tail], acc) do
sum(tail, head + acc)
end
end
TCO.sum([1, 2, 3, 4], 0)
sum([4], 6)
27. Sum function - Tail Call Optimization
defmodule TCO do
def sum([], acc), do: acc
def sum([head | tail], acc) do
sum(tail, head + acc)
end
end
TCO.sum([1, 2, 3, 4], 0)
sum([], 10)
28. Sum function - Tail Call Optimization
defmodule TCO do
def sum([], acc), do: acc
def sum([head | tail], acc) do
sum(tail, head + acc)
end
end
TCO.sum([1, 2, 3, 4], 0)
10
29. Difference
defmodule TCO do
def sum([], acc), do: acc
def sum([head | tail], acc) do
sum(tail, head + acc)
end
end
defmodule NoTCO do
def sum_no_tco([]), do: 0
def sum_no_tco([head | tail]) do
head + sum_no_tco(tail)
end
end
30. Benchmarking
iex(1)> :timer.tc fn -> NoTCO.sum_no_tco(Enum.to_list(1..100_000)) end
{17673, 5000050000}
iex(2)> :timer.tc fn -> TCO.sum(Enum.to_list(1..100_000), 0) end
{10518, 5000050000}
37. Ruby vs. Elixir - Tested on one machine
Ruby - previous service after optimization
● 200 / items per seconds
● CPU 100%
● RAM 560 mb
Elixir - before optimization
● 310 (no parallelism), 620 (paralellism)
● CPU 100%, 300%
● RAM 65 mb
38. Profiling - eprof, ExProf
“The module eprof provides a set of functions for time
profiling of Erlang programs to find out how the
execution time is used. The profiling is done using
the Erlang trace BIFs. Tracing of local function calls
for a specified set of processes is enabled when
profiling is begun, and disabled when profiling is
stopped.”
http://erlang.org/doc/man/eprof.html