フィードバックを送信 Cloud Run 用に Python アプリケーションを最適化する コレクションでコンテンツを整理 必要に応じて、コンテンツの保存と分類を行います。 このガイドでは、Python プログラミング言語で作成された Cloud Run サービスの最適化と、最適化の一部に関連したトレードオフの理解に役立つ背景情報について説明します。このページの情報は、Python にも適用される全般的な最適化のヒントを補完するものです。 これらの従来の Python ウェブベース アプリケーションのベスト プラクティスと最適化の多くは、以下を中心に展開されています。 同時リクエストの処理(スレッドベースと非ブロッキング I/O の両方)。 バックグラウンド タスクへのトレースや指標の送信など、重要性が低い機能に接続プールとバッチ処理を適用してレスポンス レイテンシを短縮する。 コンテナ
Introducing Sqlcommenter: An open source ORM auto-instrumentation library Object-relational mapping (ORM) helps developers to write queries using an object-oriented paradigm, which integrates naturally with application code in their preferred programming language. Many full-stack developers rely on ORM tools to write database code in their applications, but since the SQL statements are generated b
English version 要約 dockerはデフォルトでセキュリティ機構(Spectre脆弱性の対策)を有効にします。この影響で、RubyやPythonのようなインタプリタは速度が劣化します。特にCPU律速なプログラムで顕著に遅くなります(実行時間が倍くらいになることがあります)。 現象 Rubyで1億回ループするコードを、直接ホスト上で実行する場合と、docker上で実行する場合で実行時間を比較してみます。 直接ホスト上で実行した場合: $ ruby -ve 't = Time.now; i=0;while i<100_000_000;i+=1;end; puts "#{ Time.now - t } sec"' ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux] 1.321703922 sec docker
TL;DR: With some simple tweaks to your configuration, you can improve the execution of Python code inside Docker containers to almost native speeds: On an Ubuntu host, the benchmark execution time in Docker was about twice the native time; this difference could be negated by modifying the security settings of the containerThe difference was much smaller when running well-optimised code — rather th
Reducing Pandas memory usage #1: lossless compression by Itamar Turner-Trauring Last updated 06 Jan 2023, originally created 18 Nov 2019 You’re loading a CSV into Pandas, and it’s using too much RAM: your program crashes if you load the whole thing. How do you reduce memory usage without changing any of your processing code? In this article I’ll show you how to reduce the memory your DataFrame use
Realistic, easy, and fast enough: database tests with Docker by Itamar Turner-Trauring Last updated 22 Dec 2021, originally created 09 Feb 2019 You’re writing an application that talks to a database—PostgreSQL, MySQL, MongoDB—and you need to write some tests. You want three things out of your tests: Realism: the closer your test setup is to production, the more likely you are to catch bugs with te
pipenv 9.0.2 のリリースでCLIの大幅な高速化をしたというアナウンスを見かけました。 Just released Pipenv v9.0.2, which includes massive CLI speedups! https://t.co/AGD8Hkq1EG — Kenneth Reitz 🐍 (@kennethreitz) 2018年1月16日 興味を持ってすぐに試してみたのですが、あまり速く感じられませんでした。そこで Python 3.7 の新機能を使って速度を調査することにしました。 この記事ではその新機能と実際の使い方を紹介します。 起動時間 ≒ import時間 pipenv -h のようなコマンドの実行時間は、実際にヘルプメッセージを表示するための時間よりもずっと長くなります。 アプリケーションが起動するときには、設定ファイルの読み込みなど一定の処理が必要
bicycle1885.hatenablog.com こちらの記事を拝見していて、ちょっと気になったので注釈。 PythonやRを使っている人で、ある程度重い計算をする人達には半ば常識になっていることとして、いわゆる「for文を使ってはいけない。ベクトル化*1しろ。」という助言があります。 これは、PythonやRのようなインタープリター方式の処理系をもつ言語では、極めてfor文が遅いため、C言語やFortranで実装されたベクトル化計算を使うほうが速いという意味です。 昔からよくこういう言い方がよくされるが、本当にPythonのfor文は遅いのだろうか。 聞くところによるとRのfor文はガチで遅いそうだが、Pythonの計算が遅いのはインタープリタ方式だからでも、for文が遅いからでもない。もちろん、Pythonはインタープリタなので遅いし、for文だって極めて遅い。しかし、これはPyt
この記事について Pythonを速くする方法について語ります プロファイリングによってCPUバウンドな処理のボトルネックを見つけます 見つけたボトルネックをCythonで改善します はじめに 先日Bayesian Personalized Ranking (BPR)というレコメンドアルゴリズムを実装しました。 こちらの論文の式を参考にコードを書いてみたのですが、実行してみたらちょっと遅すぎて使えなかったため、処理速度の改善に取り組みました。 その時に試したことを備忘録的にまとめます。 この記事で用いる手法とコード BPRはユーザ x アイテムの行列の行列分解を与えます。 ユーザ x アイテムの行列$X$を、ユーザ x ファクターの行列$U$とアイテム x ファクターの行列$V$に分解します。 この問題をどのように解くかはBPRの元論文をご覧ください。 この手法を以下のように実装しました。$
This document contains the slides from a presentation given by Wes McKinney on high performance Python on Apache Spark. The presentation discusses why Python is an important and productive language, defines what is meant by "high performance Python", and explores techniques for building fast Python software such as embracing limitations of the Python interpreter and using native data structures an
トップエスイー実践プログラミングセミナーシリーズ 「TensorFlowによるニューラルネットワーク入門」 で使用した資料です。 http://topse.or.jp/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E3%82%BB%E3%83%9F%E3%83%8A%E3%83%BC%E3%80%8Ctensorflow%E3%81%AB%E3%82%88%E3%82%8B%E3%83%8B%E3%83%A5%E3%83%BC%E3%83%A9%E3%83%AB%E3%83%8D/ 2016/11/17 ver1.0 公開 2016/11/28 ver1.1 Update 2017/01/21 ver1.2 Update 2017/01/24 ver1.3 Update
line_profiler が便利です スピーチとスカートは短いほうがいい、という話を聞いたことがあります。 データ分析でも、実験をできるだけ多くしたいので、 前処理などの定型繰り返し作業はできるだけ短いほうがいいですね。 そんなときに役に立つのがプロファリングだと思います。 最近、プライベートで数10GB~サイズのデータを扱うことになりました。 その作業を通じて、並列処理、プロファイリングなどについて 小さな発見がありましたので、共有できたらなと思いました。 初回は、line_profilerでプロファイリングしたときの発見です。 line_profiler については、いろんな方が書いているので、調べて頂ければと思います。 とても素晴らしいプロジェクトです。 データの集計処理をプロファイリングする データについて 実際にあつかったデータはお見せできませんので。。。 そのデータに構造が近
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く