From 53ae1ef9b650a41568b9c8eecedd0f1dec7dba07 Mon Sep 17 00:00:00 2001 From: Valentyn Tymofieiev Date: Thu, 11 Apr 2024 16:09:32 -0700 Subject: [PATCH 1/2] Remove Cython profiling. --- sdks/python/apache_beam/coders/coder_impl.pxd | 1 - sdks/python/apache_beam/metrics/monitoring_infos.py | 1 - sdks/python/apache_beam/runners/common.py | 1 - sdks/python/apache_beam/runners/worker/opcounters.py | 1 - sdks/python/apache_beam/runners/worker/operations.py | 1 - sdks/python/apache_beam/runners/worker/statesampler_fast.pyx | 1 - sdks/python/apache_beam/testing/fast_test_utils.pxd | 1 - .../apache_beam/transforms/cy_dataflow_distribution_counter.pxd | 1 - .../apache_beam/transforms/cy_dataflow_distribution_counter.pyx | 1 - sdks/python/apache_beam/utils/counters.pxd | 1 - sdks/python/apache_beam/utils/windowed_value.py | 1 - 11 files changed, 11 deletions(-) diff --git a/sdks/python/apache_beam/coders/coder_impl.pxd b/sdks/python/apache_beam/coders/coder_impl.pxd index 0e6e31d0fc82..52889fa2fd92 100644 --- a/sdks/python/apache_beam/coders/coder_impl.pxd +++ b/sdks/python/apache_beam/coders/coder_impl.pxd @@ -15,7 +15,6 @@ # limitations under the License. # -# cython: profile=True cimport cython diff --git a/sdks/python/apache_beam/metrics/monitoring_infos.py b/sdks/python/apache_beam/metrics/monitoring_infos.py index ae12c93a5718..7bc7cced280c 100644 --- a/sdks/python/apache_beam/metrics/monitoring_infos.py +++ b/sdks/python/apache_beam/metrics/monitoring_infos.py @@ -16,7 +16,6 @@ # # cython: language_level=3 -# cython: profile=True # pytype: skip-file diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py index 721bee4fceb5..fe00b407ae19 100644 --- a/sdks/python/apache_beam/runners/common.py +++ b/sdks/python/apache_beam/runners/common.py @@ -14,7 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# cython: profile=True # cython: language_level=3 """Worker operations executor. diff --git a/sdks/python/apache_beam/runners/worker/opcounters.py b/sdks/python/apache_beam/runners/worker/opcounters.py index 8d9b36a1166f..ba53cbcbce7f 100644 --- a/sdks/python/apache_beam/runners/worker/opcounters.py +++ b/sdks/python/apache_beam/runners/worker/opcounters.py @@ -16,7 +16,6 @@ # # cython: language_level=3 -# cython: profile=True """Counters collect the progress of the Worker for reporting to the service.""" diff --git a/sdks/python/apache_beam/runners/worker/operations.py b/sdks/python/apache_beam/runners/worker/operations.py index bdb16a46aeea..00a652c49e66 100644 --- a/sdks/python/apache_beam/runners/worker/operations.py +++ b/sdks/python/apache_beam/runners/worker/operations.py @@ -16,7 +16,6 @@ # # cython: language_level=3 -# cython: profile=True """Worker operations executor.""" diff --git a/sdks/python/apache_beam/runners/worker/statesampler_fast.pyx b/sdks/python/apache_beam/runners/worker/statesampler_fast.pyx index f0e1e6ccb595..7c082b7a6226 100644 --- a/sdks/python/apache_beam/runners/worker/statesampler_fast.pyx +++ b/sdks/python/apache_beam/runners/worker/statesampler_fast.pyx @@ -15,7 +15,6 @@ # limitations under the License. # -# cython: profile=True # cython: language_level=3 """State sampler for tracking time spent in execution steps. diff --git a/sdks/python/apache_beam/testing/fast_test_utils.pxd b/sdks/python/apache_beam/testing/fast_test_utils.pxd index 5b27f8b8d42f..f8868e842b4a 100644 --- a/sdks/python/apache_beam/testing/fast_test_utils.pxd +++ b/sdks/python/apache_beam/testing/fast_test_utils.pxd @@ -15,7 +15,6 @@ # limitations under the License. # -# cython: profile=True cimport libc.stdint diff --git a/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pxd b/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pxd index 3df1a85e3a21..deab8bb16d9a 100644 --- a/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pxd +++ b/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pxd @@ -14,7 +14,6 @@ # limitations under the License. # -# cython: profile=True """ For internal use only. No backwards compatibility guarantees.""" diff --git a/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pyx b/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pyx index 6fa32c6fd5d9..c1b32356ed1f 100644 --- a/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pyx +++ b/sdks/python/apache_beam/transforms/cy_dataflow_distribution_counter.pyx @@ -14,7 +14,6 @@ # limitations under the License. # -# cython: profile=True # cython: language_level=3 """ For internal use only. No backwards compatibility guarantees.""" diff --git a/sdks/python/apache_beam/utils/counters.pxd b/sdks/python/apache_beam/utils/counters.pxd index dc38bfa61581..bb6788da8858 100644 --- a/sdks/python/apache_beam/utils/counters.pxd +++ b/sdks/python/apache_beam/utils/counters.pxd @@ -15,7 +15,6 @@ # limitations under the License. # -# cython: profile=True # cython: overflowcheck=True cdef class Counter(object): diff --git a/sdks/python/apache_beam/utils/windowed_value.py b/sdks/python/apache_beam/utils/windowed_value.py index 7bee17eb154e..fb15d3778a6a 100644 --- a/sdks/python/apache_beam/utils/windowed_value.py +++ b/sdks/python/apache_beam/utils/windowed_value.py @@ -22,7 +22,6 @@ # editing this file as WindowedValues are created for every element for # every step in a Beam pipeline. -# cython: profile=True # cython: language_level=3 # pytype: skip-file From 9732e7f8c1783f71a3eb9a4253ff6bdf1e327de6 Mon Sep 17 00:00:00 2001 From: Valentyn Tymofieiev Date: Fri, 12 Apr 2024 12:42:37 -0700 Subject: [PATCH 2/2] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 941ba23a7573..e074d84ff0a6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -68,7 +68,7 @@ ## New Features / Improvements -* X feature added (Java/Python) ([#X](https://github.com/apache/beam/issues/X)). +* Profiling of Cythonized code has been disabled by default. This might improve performance for some Python pipelines ([#30938](https://github.com/apache/beam/pull/30938)). ## Breaking Changes