SlideShare a Scribd company logo
1 of 17
Download to read offline
Introducing
wsgi_lineprof
Yusuke Miyazaki
2017-09-08
PyCon JP 2017
Yusuke Miyazaki @ymyzk
• Master’s course student of Kyoto University
• Programming languages / Type system
• Member of CAMPHOR- in Kyoto
• Community for student engineers and designers
• Intern of a start-up in Tokyo (Working Remotely)
• Uses Node.js (TypeScript & JavaScript) mainly
• We’re hiring!
Visit ymyzk.com for more details
Do you like building
web applications?

🙋🙋🙋
Do you like building

"fast"

web applications?

"""
Do you know
ISUCON?

🙋"🙋"
ISUCON = Iikanjini Speed Up Contest
• Team: 2 or 3 people
• Objective: Make the given web application faster
• Modify configuration of OS or middleware
• Add or replace middleware
• Rewrite applications…
• Rule: If a benchmark score (≈ number of requests) is high,
then you win!!
ISUCON = Iikanjini Speed Up Contest
• I participated in ISUCON in 2015 and 2016…
• But I lost in qualification rounds
• It is not easy to speed up existing applications
How can we speed
up applications?

🤔🤔🤔
— Robert C. Pike "Notes on Programming in C"
“Measure.  Don't tune for speed until you've
measured, and even then don't unless one
part of the code overwhelms the rest.”
How can we find
bottlenecks?
🤔🤔🤔
Use Profilers
• Python
• profile / cProfile
• timeit
• line_profiler
• memory_profiler
• WSGI
• Werkzurg
• linesman
They works well. But I want
more simple one for webapp

(especially for ISUCON)
I create a new profiler
for web applications

💪💪💪
🎉 wsgi_lineprof 🎉
wsgi_lineprof
• WSGI middleware
• Works well with WAFs: Django, Flask, Bottle…
• Easy to integrate with existing applications
without changing existing code of app.
• Provides line-by-line profiling
• Records every function call during a request
• Records the followings for every lines:
• Number of times the line was executed
• Amount of time spent to execute the line
How to use
# Assume that WSGI app is defined as "app"








server = make_server('127.0.0.1', 8000, app)

server.serve_forever()
# wsgi_lineprof
filters = [
FilenameFilter("main.py"),
TotalTimeSorter(),
]
app = LineProfilerMiddleware(app, filters=filters)
Demo
Conclusion
• wsgi_lineprof is a simple WSGI middleware for line-
by-line profiling
github.com/ymyzk/wsgi_lineprof
• Proposals, feedback, and PRs are welcome!
• Let’s participate in ISUCON using Python and win a
victory! 🏆🏆🏆
Thank you for Listening!!

More Related Content

What's hot

Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014
Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014
Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014Michelangelo van Dam
 
Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016Luciano Murruni
 
apidays LIVE New York 2021 - API tool chain for low budget programs by Paul K...
apidays LIVE New York 2021 - API tool chain for low budget programs by Paul K...apidays LIVE New York 2021 - API tool chain for low budget programs by Paul K...
apidays LIVE New York 2021 - API tool chain for low budget programs by Paul K...apidays
 
apidays LIVE Paris 2021 - Using OpenAPI to configure your API Gateway by Ole ...
apidays LIVE Paris 2021 - Using OpenAPI to configure your API Gateway by Ole ...apidays LIVE Paris 2021 - Using OpenAPI to configure your API Gateway by Ole ...
apidays LIVE Paris 2021 - Using OpenAPI to configure your API Gateway by Ole ...apidays
 
ng-conf NativeScript and Angular 2 Workshop
ng-conf NativeScript and Angular 2 Workshopng-conf NativeScript and Angular 2 Workshop
ng-conf NativeScript and Angular 2 Workshoptjvantoll
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessibleVictor Trakhtenberg
 
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史)
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史) PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史)
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史) Kir Chou
 
Action! Development and Operations for Sticker Shop
Action! Development and  Operations for Sticker ShopAction! Development and  Operations for Sticker Shop
Action! Development and Operations for Sticker ShopLINE Corporation
 
Understanding how to use Swagger and its tools
Understanding how to use Swagger and its toolsUnderstanding how to use Swagger and its tools
Understanding how to use Swagger and its toolsSwagger API
 
Swagger in the API Lifecycle
Swagger in the API LifecycleSwagger in the API Lifecycle
Swagger in the API LifecycleOle Lensmar
 
Documentation-driven development for Python web APIs v2
Documentation-driven development for Python web APIs v2Documentation-driven development for Python web APIs v2
Documentation-driven development for Python web APIs v2José Haro Peralta
 
Fastlane on Android 介紹
Fastlane on Android 介紹Fastlane on Android 介紹
Fastlane on Android 介紹Kros Huang
 
Android development at mercari 2015
Android development at mercari 2015Android development at mercari 2015
Android development at mercari 2015Tomoaki Imai
 
NativeScript Developer Day Keynote - Todd Anglin & Burke Holland
NativeScript Developer Day Keynote - Todd Anglin & Burke HollandNativeScript Developer Day Keynote - Todd Anglin & Burke Holland
NativeScript Developer Day Keynote - Todd Anglin & Burke HollandBrian Rinaldi
 
Docker Containers - Talk Linux Day 2015
Docker Containers - Talk Linux Day 2015Docker Containers - Talk Linux Day 2015
Docker Containers - Talk Linux Day 2015Fabio Ferrari
 

What's hot (20)

Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014
Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014
Pimp legacy PHP apps with Apigility - TrueNorthPHP 2014
 
Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016
 
apidays LIVE New York 2021 - API tool chain for low budget programs by Paul K...
apidays LIVE New York 2021 - API tool chain for low budget programs by Paul K...apidays LIVE New York 2021 - API tool chain for low budget programs by Paul K...
apidays LIVE New York 2021 - API tool chain for low budget programs by Paul K...
 
apidays LIVE Paris 2021 - Using OpenAPI to configure your API Gateway by Ole ...
apidays LIVE Paris 2021 - Using OpenAPI to configure your API Gateway by Ole ...apidays LIVE Paris 2021 - Using OpenAPI to configure your API Gateway by Ole ...
apidays LIVE Paris 2021 - Using OpenAPI to configure your API Gateway by Ole ...
 
TypeScript
TypeScriptTypeScript
TypeScript
 
ng-conf NativeScript and Angular 2 Workshop
ng-conf NativeScript and Angular 2 Workshopng-conf NativeScript and Angular 2 Workshop
ng-conf NativeScript and Angular 2 Workshop
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessible
 
Full Stack Flutter Testing
Full Stack Flutter Testing Full Stack Flutter Testing
Full Stack Flutter Testing
 
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史)
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史) PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史)
PyCon TW 2018 - A Python Engineer Under Giant Umbrella (巨大保護傘下的 Python 碼農辛酸史)
 
3.html configuration
3.html configuration3.html configuration
3.html configuration
 
Action! Development and Operations for Sticker Shop
Action! Development and  Operations for Sticker ShopAction! Development and  Operations for Sticker Shop
Action! Development and Operations for Sticker Shop
 
Understanding how to use Swagger and its tools
Understanding how to use Swagger and its toolsUnderstanding how to use Swagger and its tools
Understanding how to use Swagger and its tools
 
Swagger in the API Lifecycle
Swagger in the API LifecycleSwagger in the API Lifecycle
Swagger in the API Lifecycle
 
Documentation-driven development for Python web APIs v2
Documentation-driven development for Python web APIs v2Documentation-driven development for Python web APIs v2
Documentation-driven development for Python web APIs v2
 
Fastlane on Android 介紹
Fastlane on Android 介紹Fastlane on Android 介紹
Fastlane on Android 介紹
 
Android development at mercari 2015
Android development at mercari 2015Android development at mercari 2015
Android development at mercari 2015
 
API Conference 2021
API Conference 2021API Conference 2021
API Conference 2021
 
NativeScript Developer Day Keynote - Todd Anglin & Burke Holland
NativeScript Developer Day Keynote - Todd Anglin & Burke HollandNativeScript Developer Day Keynote - Todd Anglin & Burke Holland
NativeScript Developer Day Keynote - Todd Anglin & Burke Holland
 
Docker Containers - Talk Linux Day 2015
Docker Containers - Talk Linux Day 2015Docker Containers - Talk Linux Day 2015
Docker Containers - Talk Linux Day 2015
 
Nativescript with angular 2
Nativescript with angular 2Nativescript with angular 2
Nativescript with angular 2
 

Viewers also liked

Pycon jp2017 20170908_ota
Pycon jp2017 20170908_otaPycon jp2017 20170908_ota
Pycon jp2017 20170908_ota博三 太田
 
プロダクト開発してわかったDjangoの深〜いパーミッション管理の話 @ PyconJP2017
プロダクト開発してわかったDjangoの深〜いパーミッション管理の話 @ PyconJP2017プロダクト開発してわかったDjangoの深〜いパーミッション管理の話 @ PyconJP2017
プロダクト開発してわかったDjangoの深〜いパーミッション管理の話 @ PyconJP2017hirokiky
 
Pythonとパッケージングと私
Pythonとパッケージングと私Pythonとパッケージングと私
Pythonとパッケージングと私Atsushi Odagiri
 
ドローンのフライトコントローラをPythonで制御してみた話
ドローンのフライトコントローラをPythonで制御してみた話ドローンのフライトコントローラをPythonで制御してみた話
ドローンのフライトコントローラをPythonで制御してみた話Lina Katayose
 
Pythonが動く仕組み(の概要)
Pythonが動く仕組み(の概要)Pythonが動く仕組み(の概要)
Pythonが動く仕組み(の概要)Yoshiaki Shibutani
 
Djangoフレームワークのユーザーモデルと認証
Djangoフレームワークのユーザーモデルと認証Djangoフレームワークのユーザーモデルと認証
Djangoフレームワークのユーザーモデルと認証Shinya Okano
 
PyCon JP 2017Yuta Kitagami
PyCon JP 2017Yuta KitagamiPyCon JP 2017Yuta Kitagami
PyCon JP 2017Yuta KitagamiYuta Kitagami
 
Python におけるドメイン駆動設計(戦術面)の勘どころ
Python におけるドメイン駆動設計(戦術面)の勘どころPython におけるドメイン駆動設計(戦術面)の勘どころ
Python におけるドメイン駆動設計(戦術面)の勘どころJunya Hayashi
 
PyconJP2017 Kivyによるアプリケーション開発のすすめ
PyconJP2017 Kivyによるアプリケーション開発のすすめPyconJP2017 Kivyによるアプリケーション開発のすすめ
PyconJP2017 Kivyによるアプリケーション開発のすすめJun Okazaki
 
Pythonはどうやってlen関数で長さを手にいれているの?
Pythonはどうやってlen関数で長さを手にいれているの?Pythonはどうやってlen関数で長さを手にいれているの?
Pythonはどうやってlen関数で長さを手にいれているの?Takayuki Shimizukawa
 
Pythonと機械学習によるWebセキュリティの自動化
Pythonと機械学習によるWebセキュリティの自動化Pythonと機械学習によるWebセキュリティの自動化
Pythonと機械学習によるWebセキュリティの自動化Isao Takaesu
 

Viewers also liked (12)

Pycon jp2017 20170908_ota
Pycon jp2017 20170908_otaPycon jp2017 20170908_ota
Pycon jp2017 20170908_ota
 
プロダクト開発してわかったDjangoの深〜いパーミッション管理の話 @ PyconJP2017
プロダクト開発してわかったDjangoの深〜いパーミッション管理の話 @ PyconJP2017プロダクト開発してわかったDjangoの深〜いパーミッション管理の話 @ PyconJP2017
プロダクト開発してわかったDjangoの深〜いパーミッション管理の話 @ PyconJP2017
 
Pythonとパッケージングと私
Pythonとパッケージングと私Pythonとパッケージングと私
Pythonとパッケージングと私
 
ドローンのフライトコントローラをPythonで制御してみた話
ドローンのフライトコントローラをPythonで制御してみた話ドローンのフライトコントローラをPythonで制御してみた話
ドローンのフライトコントローラをPythonで制御してみた話
 
Pythonが動く仕組み(の概要)
Pythonが動く仕組み(の概要)Pythonが動く仕組み(の概要)
Pythonが動く仕組み(の概要)
 
Djangoフレームワークのユーザーモデルと認証
Djangoフレームワークのユーザーモデルと認証Djangoフレームワークのユーザーモデルと認証
Djangoフレームワークのユーザーモデルと認証
 
PyCon JP 2017Yuta Kitagami
PyCon JP 2017Yuta KitagamiPyCon JP 2017Yuta Kitagami
PyCon JP 2017Yuta Kitagami
 
Python におけるドメイン駆動設計(戦術面)の勘どころ
Python におけるドメイン駆動設計(戦術面)の勘どころPython におけるドメイン駆動設計(戦術面)の勘どころ
Python におけるドメイン駆動設計(戦術面)の勘どころ
 
PyconJP2017 Kivyによるアプリケーション開発のすすめ
PyconJP2017 Kivyによるアプリケーション開発のすすめPyconJP2017 Kivyによるアプリケーション開発のすすめ
PyconJP2017 Kivyによるアプリケーション開発のすすめ
 
Pythonはどうやってlen関数で長さを手にいれているの?
Pythonはどうやってlen関数で長さを手にいれているの?Pythonはどうやってlen関数で長さを手にいれているの?
Pythonはどうやってlen関数で長さを手にいれているの?
 
Pycon2017
Pycon2017Pycon2017
Pycon2017
 
Pythonと機械学習によるWebセキュリティの自動化
Pythonと機械学習によるWebセキュリティの自動化Pythonと機械学習によるWebセキュリティの自動化
Pythonと機械学習によるWebセキュリティの自動化
 

Similar to Introducing wsgi_lineprof / PyCon JP 2017 LT

O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfO365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfNCCOMMS
 
Java 8 - Gateway Drug or End of Line?
Java 8 - Gateway Drug or End of Line?Java 8 - Gateway Drug or End of Line?
Java 8 - Gateway Drug or End of Line?Garth Gilmour
 
Building front-end apps that Scale - FOSDEM 2014
Building front-end apps that Scale - FOSDEM 2014Building front-end apps that Scale - FOSDEM 2014
Building front-end apps that Scale - FOSDEM 2014Phil Leggetter
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-upTroy Miles
 
Progressive Enhancement using WSGI
Progressive Enhancement using WSGIProgressive Enhancement using WSGI
Progressive Enhancement using WSGIMatthew Wilkes
 
Cross Platform Angular 2 and TypeScript Development
Cross Platform Angular 2 and TypeScript DevelopmentCross Platform Angular 2 and TypeScript Development
Cross Platform Angular 2 and TypeScript DevelopmentJeremy Likness
 
Swagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierSwagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierMiroslav Resetar
 
Azure tales: a real world CQRS and ES Deep Dive - Andrea Saltarello
Azure tales: a real world CQRS and ES Deep Dive - Andrea SaltarelloAzure tales: a real world CQRS and ES Deep Dive - Andrea Saltarello
Azure tales: a real world CQRS and ES Deep Dive - Andrea SaltarelloITCamp
 
DevOps: Automate all the things
DevOps: Automate all the thingsDevOps: Automate all the things
DevOps: Automate all the thingsMat Mannion
 
Fed London - January 2015
Fed London - January 2015Fed London - January 2015
Fed London - January 2015Phil Leggetter
 
DaZhangJM0203JM0203
DaZhangJM0203JM0203DaZhangJM0203JM0203
DaZhangJM0203JM0203Da Zhang
 
Optimus XPages: An Explosion of Techniques and Best Practices
Optimus XPages: An Explosion of Techniques and Best PracticesOptimus XPages: An Explosion of Techniques and Best Practices
Optimus XPages: An Explosion of Techniques and Best PracticesTeamstudio
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project Elad Hirsch
 
_Python Ireland Meetup - Serverless ML - Dowling.pdf
_Python Ireland Meetup - Serverless ML - Dowling.pdf_Python Ireland Meetup - Serverless ML - Dowling.pdf
_Python Ireland Meetup - Serverless ML - Dowling.pdfJim Dowling
 
CI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and MockitoCI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and MockitoC4Media
 
BelTech 2017 - Building Quality in the Browser
BelTech 2017 - Building Quality in the BrowserBelTech 2017 - Building Quality in the Browser
BelTech 2017 - Building Quality in the BrowserEamonn Boyle
 

Similar to Introducing wsgi_lineprof / PyCon JP 2017 LT (20)

O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio StruyfO365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
O365Con18 - Automate your Tasks through Azure Functions - Elio Struyf
 
[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions[Struyf] Automate Your Tasks With Azure Functions
[Struyf] Automate Your Tasks With Azure Functions
 
Service worker API
Service worker APIService worker API
Service worker API
 
Java 8 - Gateway Drug or End of Line?
Java 8 - Gateway Drug or End of Line?Java 8 - Gateway Drug or End of Line?
Java 8 - Gateway Drug or End of Line?
 
Building front-end apps that Scale - FOSDEM 2014
Building front-end apps that Scale - FOSDEM 2014Building front-end apps that Scale - FOSDEM 2014
Building front-end apps that Scale - FOSDEM 2014
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
 
Progressive Enhancement using WSGI
Progressive Enhancement using WSGIProgressive Enhancement using WSGI
Progressive Enhancement using WSGI
 
Django course
Django courseDjango course
Django course
 
Cross Platform Angular 2 and TypeScript Development
Cross Platform Angular 2 and TypeScript DevelopmentCross Platform Angular 2 and TypeScript Development
Cross Platform Angular 2 and TypeScript Development
 
Resume
ResumeResume
Resume
 
Swagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlierSwagger - Making REST APIs friendlier
Swagger - Making REST APIs friendlier
 
Azure tales: a real world CQRS and ES Deep Dive - Andrea Saltarello
Azure tales: a real world CQRS and ES Deep Dive - Andrea SaltarelloAzure tales: a real world CQRS and ES Deep Dive - Andrea Saltarello
Azure tales: a real world CQRS and ES Deep Dive - Andrea Saltarello
 
DevOps: Automate all the things
DevOps: Automate all the thingsDevOps: Automate all the things
DevOps: Automate all the things
 
Fed London - January 2015
Fed London - January 2015Fed London - January 2015
Fed London - January 2015
 
DaZhangJM0203JM0203
DaZhangJM0203JM0203DaZhangJM0203JM0203
DaZhangJM0203JM0203
 
Optimus XPages: An Explosion of Techniques and Best Practices
Optimus XPages: An Explosion of Techniques and Best PracticesOptimus XPages: An Explosion of Techniques and Best Practices
Optimus XPages: An Explosion of Techniques and Best Practices
 
AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
_Python Ireland Meetup - Serverless ML - Dowling.pdf
_Python Ireland Meetup - Serverless ML - Dowling.pdf_Python Ireland Meetup - Serverless ML - Dowling.pdf
_Python Ireland Meetup - Serverless ML - Dowling.pdf
 
CI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and MockitoCI/CD: Lessons from LinkedIn and Mockito
CI/CD: Lessons from LinkedIn and Mockito
 
BelTech 2017 - Building Quality in the Browser
BelTech 2017 - Building Quality in the BrowserBelTech 2017 - Building Quality in the Browser
BelTech 2017 - Building Quality in the Browser
 

More from Yusuke Miyazaki

Dynamic Type Inference for Gradual Hindley–Milner Typing
Dynamic Type Inference for Gradual Hindley–Milner TypingDynamic Type Inference for Gradual Hindley–Milner Typing
Dynamic Type Inference for Gradual Hindley–Milner TypingYusuke Miyazaki
 
Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話Yusuke Miyazaki
 
オープンソースソフトウェア入門
オープンソースソフトウェア入門オープンソースソフトウェア入門
オープンソースソフトウェア入門Yusuke Miyazaki
 
型ヒントについて考えよう!
型ヒントについて考えよう!型ヒントについて考えよう!
型ヒントについて考えよう!Yusuke Miyazaki
 
Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話Yusuke Miyazaki
 
iOS 開発のいま (ADF2015 LT会)
iOS 開発のいま (ADF2015 LT会)iOS 開発のいま (ADF2015 LT会)
iOS 開発のいま (ADF2015 LT会)Yusuke Miyazaki
 
iOS 開発のいま (CAMPHOR- x KMC 合同LT会)
iOS 開発のいま (CAMPHOR- x KMC 合同LT会)iOS 開発のいま (CAMPHOR- x KMC 合同LT会)
iOS 開発のいま (CAMPHOR- x KMC 合同LT会)Yusuke Miyazaki
 
最新の iOS に対応したアプリの開発
最新の iOS に対応したアプリの開発最新の iOS に対応したアプリの開発
最新の iOS に対応したアプリの開発Yusuke Miyazaki
 
コンピューターネットワーク入門
コンピューターネットワーク入門コンピューターネットワーク入門
コンピューターネットワーク入門Yusuke Miyazaki
 

More from Yusuke Miyazaki (12)

Dynamic Type Inference for Gradual Hindley–Milner Typing
Dynamic Type Inference for Gradual Hindley–Milner TypingDynamic Type Inference for Gradual Hindley–Milner Typing
Dynamic Type Inference for Gradual Hindley–Milner Typing
 
Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話Python と Docker で mypy Playground を開発した話
Python と Docker で mypy Playground を開発した話
 
オープンソースソフトウェア入門
オープンソースソフトウェア入門オープンソースソフトウェア入門
オープンソースソフトウェア入門
 
型ヒントについて考えよう!
型ヒントについて考えよう!型ヒントについて考えよう!
型ヒントについて考えよう!
 
iot.ymyzk.com の紹介
iot.ymyzk.com の紹介iot.ymyzk.com の紹介
iot.ymyzk.com の紹介
 
Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話Django から各種チャットツールに通知するライブラリを作った話
Django から各種チャットツールに通知するライブラリを作った話
 
iOS 開発のいま (ADF2015 LT会)
iOS 開発のいま (ADF2015 LT会)iOS 開発のいま (ADF2015 LT会)
iOS 開発のいま (ADF2015 LT会)
 
iOS 開発のいま (CAMPHOR- x KMC 合同LT会)
iOS 開発のいま (CAMPHOR- x KMC 合同LT会)iOS 開発のいま (CAMPHOR- x KMC 合同LT会)
iOS 開発のいま (CAMPHOR- x KMC 合同LT会)
 
Swift の問題点
Swift の問題点Swift の問題点
Swift の問題点
 
最新の iOS に対応したアプリの開発
最新の iOS に対応したアプリの開発最新の iOS に対応したアプリの開発
最新の iOS に対応したアプリの開発
 
コンピューターネットワーク入門
コンピューターネットワーク入門コンピューターネットワーク入門
コンピューターネットワーク入門
 
HTML初心者講座
HTML初心者講座HTML初心者講座
HTML初心者講座
 

Recently uploaded

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
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 WorkerThousandEyes
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
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 ApplicationsAlberto González Trastoy
 

Recently uploaded (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
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
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
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
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
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
 

Introducing wsgi_lineprof / PyCon JP 2017 LT

  • 2. Yusuke Miyazaki @ymyzk • Master’s course student of Kyoto University • Programming languages / Type system • Member of CAMPHOR- in Kyoto • Community for student engineers and designers • Intern of a start-up in Tokyo (Working Remotely) • Uses Node.js (TypeScript & JavaScript) mainly • We’re hiring! Visit ymyzk.com for more details
  • 3. Do you like building web applications?
 🙋🙋🙋
  • 4. Do you like building
 "fast"
 web applications?
 """
  • 6. ISUCON = Iikanjini Speed Up Contest • Team: 2 or 3 people • Objective: Make the given web application faster • Modify configuration of OS or middleware • Add or replace middleware • Rewrite applications… • Rule: If a benchmark score (≈ number of requests) is high, then you win!!
  • 7. ISUCON = Iikanjini Speed Up Contest • I participated in ISUCON in 2015 and 2016… • But I lost in qualification rounds • It is not easy to speed up existing applications
  • 8. How can we speed up applications?
 🤔🤔🤔
  • 9. — Robert C. Pike "Notes on Programming in C" “Measure.  Don't tune for speed until you've measured, and even then don't unless one part of the code overwhelms the rest.”
  • 10. How can we find bottlenecks? 🤔🤔🤔
  • 11. Use Profilers • Python • profile / cProfile • timeit • line_profiler • memory_profiler • WSGI • Werkzurg • linesman They works well. But I want more simple one for webapp
 (especially for ISUCON)
  • 12. I create a new profiler for web applications
 💪💪💪
  • 14. wsgi_lineprof • WSGI middleware • Works well with WAFs: Django, Flask, Bottle… • Easy to integrate with existing applications without changing existing code of app. • Provides line-by-line profiling • Records every function call during a request • Records the followings for every lines: • Number of times the line was executed • Amount of time spent to execute the line
  • 15. How to use # Assume that WSGI app is defined as "app" 
 
 
 
 server = make_server('127.0.0.1', 8000, app)
 server.serve_forever() # wsgi_lineprof filters = [ FilenameFilter("main.py"), TotalTimeSorter(), ] app = LineProfilerMiddleware(app, filters=filters)
  • 16. Demo
  • 17. Conclusion • wsgi_lineprof is a simple WSGI middleware for line- by-line profiling github.com/ymyzk/wsgi_lineprof • Proposals, feedback, and PRs are welcome! • Let’s participate in ISUCON using Python and win a victory! 🏆🏆🏆 Thank you for Listening!!