SlideShare a Scribd company logo
1 of 14
Performance
Profiling and
Numeric Python
BEN WELLER
Brief Problem Statement
 Reading DIRECTLY off the slides
 Never posts the slides
 Video is available
 Automatically grab all the slides
 Quickly underwhelmed with speed
 How to speed this up
 Speed has never been an issue previously
Python isn’t the Problem*
 The fault dear programmer isn’t in Python
 But sometimes it is
 Get around it
 Async
 C extension
 Pypy (JIT everything)
 Numba (just JIT certain methods)
Before Anything Else:
 Software Hierarchy of needs
Fast enough?
Tests
Does the code
work?
Initial Code/Data
 Reading the frames:
 Data:
 1920 x 1080 x 3
 All pixels recorded in the video, then 3 values for each pixel (RGB)
 Test for validation:
Version 0.0
 Establish a baseline
 Time: 788.85
Version 0.1
 Remove all the redundant lines:
 Time: 728.88
Version 0.15
 Apply Numba
 Time: 200.35
Version 0.175
 Realize your calculation is wrong!
 Redo with new formula
 Time: 582.29
Version 0.2
 Apply numba
 Very slow odd results
 Time: 1020.90
 Results: [4458465513457839.0, 2137656293717757.8, 3461590301822020.5,
2435933916096979.0, 1020423444981550.0 …]
 Not bounded between 0 and 100
Version 0.75
 Realize there’s something wrong with broadcast operations?
 Time: 549.63
 Output was all in the valid range
Version 1.0
 Apply numba in full force
 Time: 186.37
What I learned
 Follow the hierarchy of needs!
 If you don’t you will get burned
 Tests/initial benchmarks are key
 Slowest code first
 Incrementally solve the next bit
 Very rarely, break out specialized tools
 Know your tools
 Has anyone ran in to the problem I had with broadcasting?

More Related Content

Similar to Performance Profiling and Numeric Python

Zipline—Airbnb’s Declarative Feature Engineering Framework
Zipline—Airbnb’s Declarative Feature Engineering FrameworkZipline—Airbnb’s Declarative Feature Engineering Framework
Zipline—Airbnb’s Declarative Feature Engineering Framework
Databricks
 
Ph.D Defense Clément Béra
Ph.D Defense Clément BéraPh.D Defense Clément Béra
Ph.D Defense Clément Béra
Clément Béra
 
Move out from AppEngine, and Python PaaS alternatives
Move out from AppEngine, and Python PaaS alternativesMove out from AppEngine, and Python PaaS alternatives
Move out from AppEngine, and Python PaaS alternatives
tzang ms
 
Unit testing for the TYPO3 4.x core
Unit testing for the TYPO3 4.x coreUnit testing for the TYPO3 4.x core
Unit testing for the TYPO3 4.x core
Oliver Klee
 
HW Emulators: Does it Belong in your Verification Tool Chest?
HW Emulators: Does it Belong in your Verification Tool Chest?HW Emulators: Does it Belong in your Verification Tool Chest?
HW Emulators: Does it Belong in your Verification Tool Chest?
DVClub
 

Similar to Performance Profiling and Numeric Python (20)

ELC-E 2010: The Right Approach to Minimal Boot Times
ELC-E 2010: The Right Approach to Minimal Boot TimesELC-E 2010: The Right Approach to Minimal Boot Times
ELC-E 2010: The Right Approach to Minimal Boot Times
 
Big Data Expo 2015 - Anchormen Distributed video analysis
Big Data Expo 2015 - Anchormen Distributed video analysisBig Data Expo 2015 - Anchormen Distributed video analysis
Big Data Expo 2015 - Anchormen Distributed video analysis
 
Keynote AST 2016
Keynote AST 2016Keynote AST 2016
Keynote AST 2016
 
Zipline—Airbnb’s Declarative Feature Engineering Framework
Zipline—Airbnb’s Declarative Feature Engineering FrameworkZipline—Airbnb’s Declarative Feature Engineering Framework
Zipline—Airbnb’s Declarative Feature Engineering Framework
 
LabVIEW Report
LabVIEW  ReportLabVIEW  Report
LabVIEW Report
 
Ph.D Defense Clément Béra
Ph.D Defense Clément BéraPh.D Defense Clément Béra
Ph.D Defense Clément Béra
 
Squeezing Blood From a Stone V1.2
Squeezing Blood From a Stone V1.2Squeezing Blood From a Stone V1.2
Squeezing Blood From a Stone V1.2
 
IMAGE PROCESSING
IMAGE PROCESSINGIMAGE PROCESSING
IMAGE PROCESSING
 
智慧檢測技術與工業自動化
智慧檢測技術與工業自動化智慧檢測技術與工業自動化
智慧檢測技術與工業自動化
 
Move out from AppEngine, and Python PaaS alternatives
Move out from AppEngine, and Python PaaS alternativesMove out from AppEngine, and Python PaaS alternatives
Move out from AppEngine, and Python PaaS alternatives
 
Circular barcode design resistant to linear motion blur (preliminary slides)
Circular barcode design resistant to linear motion blur (preliminary slides)Circular barcode design resistant to linear motion blur (preliminary slides)
Circular barcode design resistant to linear motion blur (preliminary slides)
 
Unit testing for the TYPO3 4.x core
Unit testing for the TYPO3 4.x coreUnit testing for the TYPO3 4.x core
Unit testing for the TYPO3 4.x core
 
IoT evolution
IoT evolutionIoT evolution
IoT evolution
 
Continuous Delivery for Python Developers – PyCon Otto
Continuous Delivery for Python Developers – PyCon OttoContinuous Delivery for Python Developers – PyCon Otto
Continuous Delivery for Python Developers – PyCon Otto
 
Raspberry pi jam july
Raspberry pi jam julyRaspberry pi jam july
Raspberry pi jam july
 
Elizabeth Perry: Processing programming language, part 2
Elizabeth Perry: Processing programming language, part 2Elizabeth Perry: Processing programming language, part 2
Elizabeth Perry: Processing programming language, part 2
 
Python testing like a pro by Keith Yang
Python testing like a pro by Keith YangPython testing like a pro by Keith Yang
Python testing like a pro by Keith Yang
 
HW Emulators: Does it Belong in your Verification Tool Chest?
HW Emulators: Does it Belong in your Verification Tool Chest?HW Emulators: Does it Belong in your Verification Tool Chest?
HW Emulators: Does it Belong in your Verification Tool Chest?
 
Capturing and Displaying Digital Image
Capturing and Displaying  Digital ImageCapturing and Displaying  Digital Image
Capturing and Displaying Digital Image
 
Cuda meetup presentation 5
Cuda meetup presentation 5Cuda meetup presentation 5
Cuda meetup presentation 5
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Recently uploaded (20)

How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 

Performance Profiling and Numeric Python

  • 2. Brief Problem Statement  Reading DIRECTLY off the slides  Never posts the slides  Video is available  Automatically grab all the slides  Quickly underwhelmed with speed  How to speed this up  Speed has never been an issue previously
  • 3. Python isn’t the Problem*  The fault dear programmer isn’t in Python  But sometimes it is  Get around it  Async  C extension  Pypy (JIT everything)  Numba (just JIT certain methods)
  • 4. Before Anything Else:  Software Hierarchy of needs Fast enough? Tests Does the code work?
  • 5. Initial Code/Data  Reading the frames:  Data:  1920 x 1080 x 3  All pixels recorded in the video, then 3 values for each pixel (RGB)  Test for validation:
  • 6. Version 0.0  Establish a baseline  Time: 788.85
  • 7. Version 0.1  Remove all the redundant lines:  Time: 728.88
  • 8. Version 0.15  Apply Numba  Time: 200.35
  • 9. Version 0.175  Realize your calculation is wrong!  Redo with new formula  Time: 582.29
  • 10. Version 0.2  Apply numba  Very slow odd results  Time: 1020.90  Results: [4458465513457839.0, 2137656293717757.8, 3461590301822020.5, 2435933916096979.0, 1020423444981550.0 …]  Not bounded between 0 and 100
  • 11.
  • 12. Version 0.75  Realize there’s something wrong with broadcast operations?  Time: 549.63  Output was all in the valid range
  • 13. Version 1.0  Apply numba in full force  Time: 186.37
  • 14. What I learned  Follow the hierarchy of needs!  If you don’t you will get burned  Tests/initial benchmarks are key  Slowest code first  Incrementally solve the next bit  Very rarely, break out specialized tools  Know your tools  Has anyone ran in to the problem I had with broadcasting?