all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#59177] [PATCH] python-protobuf: Use C++ implementation
@ 2022-11-10  8:23 Ontje.Luensdorf
  2022-11-28 21:58 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Ontje.Luensdorf @ 2022-11-10  8:23 UTC (permalink / raw)
  To: 59177

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]

Hi Guix,

this patch configures python-protobuf to use the C++ protobuf
implementation. This additional dependency pays off with a 10x
performance improvement in some of my workloads.

Best regards,
Ontje

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-python-protobuf-Use-C-implementation.patch --]
[-- Type: text/x-patch; name="0001-gnu-python-protobuf-Use-C-implementation.patch", Size: 1108 bytes --]

From f2675cccf54d2bb1291ba1614ca44966730734e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ontje=20L=C3=BCnsdorf?= <ontje.luensdorf@dlr.de>
Date: Thu, 10 Nov 2022 09:11:11 +0100
Subject: [PATCH] gnu: python-protobuf: Use C++ implementation.

* gnu/packages/protobuf.scm (python-protobuf): Use C++ implementation.
  [propagated-inputs]: Add protobuf.
  [arguments]: Add --cpp_implementation configure flags.
---
 gnu/packages/protobuf.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm
index 1448691a42..9be35783fb 100644
--- a/gnu/packages/protobuf.scm
+++ b/gnu/packages/protobuf.scm
@@ -393,6 +393,9 @@ (define-public python-protobuf
         (base32
          "1ja2vpk9nklllmsirmil2s4l7ni9yfqvbvj47zz5xx17s1k1bhxd"))))
     (build-system python-build-system)
+    (propagated-inputs (list protobuf))
+    (arguments
+     `(#:configure-flags '("--cpp_implementation")))
     (home-page "https://github.com/google/protobuf")
     (synopsis "Protocol buffers is a data interchange format")
     (description
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#59177] [PATCH] python-protobuf: Use C++ implementation
  2022-11-10  8:23 [bug#59177] [PATCH] python-protobuf: Use C++ implementation Ontje.Luensdorf
@ 2022-11-28 21:58 ` Ludovic Courtès
  2022-11-29  8:23   ` Ontje.Luensdorf
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2022-11-28 21:58 UTC (permalink / raw)
  To: Ontje.Luensdorf; +Cc: 59177

Hi,

<Ontje.Luensdorf@dlr.de> skribis:

> this patch configures python-protobuf to use the C++ protobuf
> implementation. This additional dependency pays off with a 10x
> performance improvement in some of my workloads.

Impressive.  It would be nice to have that info as a comment in the code
for future reference.

> From f2675cccf54d2bb1291ba1614ca44966730734e1 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ontje=20L=C3=BCnsdorf?= <ontje.luensdorf@dlr.de>
> Date: Thu, 10 Nov 2022 09:11:11 +0100
> Subject: [PATCH] gnu: python-protobuf: Use C++ implementation.
>
> * gnu/packages/protobuf.scm (python-protobuf): Use C++ implementation.
>   [propagated-inputs]: Add protobuf.
>   [arguments]: Add --cpp_implementation configure flags.
> ---
>  gnu/packages/protobuf.scm | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm
> index 1448691a42..9be35783fb 100644
> --- a/gnu/packages/protobuf.scm
> +++ b/gnu/packages/protobuf.scm
> @@ -393,6 +393,9 @@ (define-public python-protobuf
>          (base32
>           "1ja2vpk9nklllmsirmil2s4l7ni9yfqvbvj47zz5xx17s1k1bhxd"))))
>      (build-system python-build-system)
> +    (propagated-inputs (list protobuf))

Does it really need to be propagated?  Would be nice if this could be
avoided, for instance by adding a phase that hardcodes the absolute file
name of the protobuf shared library, if that’s the reason why it’s being
propagated.   And if we really have to propagate it, then it’d be nice
to clarify what.  WDYT?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#59177] [PATCH] python-protobuf: Use C++ implementation
  2022-11-28 21:58 ` Ludovic Courtès
@ 2022-11-29  8:23   ` Ontje.Luensdorf
  2022-12-02 13:13     ` bug#59177: " Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Ontje.Luensdorf @ 2022-11-29  8:23 UTC (permalink / raw)
  To: ludo; +Cc: 59177

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

Hi Ludovic,


Ludovic Courtès <ludo@gnu.org> writes:

> Impressive.  It would be nice to have that info as a comment in the code
> for future reference.

...

> Does it really need to be propagated?  Would be nice if this could be
> avoided, for instance by adding a phase that hardcodes the absolute file
> name of the protobuf shared library, if that’s the reason why it’s being
> propagated.   And if we really have to propagate it, then it’d be nice
> to clarify what.  WDYT?

you are right, it doesn't need to be propagated, the python shared
object paths look good if inputs is used instead of propagated-inputs
(thanks, good to know :)

$ ldd /gnu/store/r6lxp1x9lj0a4980730pyd44mcvqv8pr-python-protobuf-3.20.1/lib/python3.9/site-packages/google/protobuf/pyext/_message.cpython-39-x86_64-linux-gnu.so 
        linux-vdso.so.1 (0x00007ffe50ba5000)
        libprotobuf.so.32 => /gnu/store/75d8pq1yxixr10dxfw59lv8k294nrck5-protobuf-3.21.9/lib/libprotobuf.so.32 (0x00007ffa6b600000)
...

I've also added a comment in the updated patch below.

Thanks & best regards,
Ontje

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-python-protobuf-Use-C-implementation.patch --]
[-- Type: text/x-patch; name="0001-gnu-python-protobuf-Use-C-implementation.patch", Size: 1294 bytes --]

From a1f443dcf7ad1e222a9796441f6d96425dbfe787 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ontje=20L=C3=BCnsdorf?= <ontje.luensdorf@dlr.de>
Date: Thu, 10 Nov 2022 09:11:11 +0100
Subject: [PATCH] gnu: python-protobuf: Use C++ implementation.

* gnu/packages/protobuf.scm (python-protobuf): Use C++ implementation.
  [inputs]: Add protobuf.
  [arguments]: Add --cpp_implementation configure flags.
---
 gnu/packages/protobuf.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm
index f7184bd49a..ab701b254d 100644
--- a/gnu/packages/protobuf.scm
+++ b/gnu/packages/protobuf.scm
@@ -406,6 +406,12 @@ (define-public python-protobuf
         (base32
          "1ja2vpk9nklllmsirmil2s4l7ni9yfqvbvj47zz5xx17s1k1bhxd"))))
     (build-system python-build-system)
+    (inputs (list protobuf))
+    (arguments
+     `(;; Favor C++ implementation from protobuf over the native Python
+       ;; implementation. The additional dependency yields significant
+       ;; performance improvements for some workloads.
+       #:configure-flags '("--cpp_implementation")))
     (home-page "https://github.com/google/protobuf")
     (synopsis "Protocol buffers is a data interchange format")
     (description
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#59177: [PATCH] python-protobuf: Use C++ implementation
  2022-11-29  8:23   ` Ontje.Luensdorf
@ 2022-12-02 13:13     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2022-12-02 13:13 UTC (permalink / raw)
  To: Ontje.Luensdorf; +Cc: 59177-done

Hi,

<Ontje.Luensdorf@dlr.de> skribis:

> From a1f443dcf7ad1e222a9796441f6d96425dbfe787 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ontje=20L=C3=BCnsdorf?= <ontje.luensdorf@dlr.de>
> Date: Thu, 10 Nov 2022 09:11:11 +0100
> Subject: [PATCH] gnu: python-protobuf: Use C++ implementation.
>
> * gnu/packages/protobuf.scm (python-protobuf): Use C++ implementation.
>   [inputs]: Add protobuf.
>   [arguments]: Add --cpp_implementation configure flags.

Perfect.  Applied, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-02 13:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-10  8:23 [bug#59177] [PATCH] python-protobuf: Use C++ implementation Ontje.Luensdorf
2022-11-28 21:58 ` Ludovic Courtès
2022-11-29  8:23   ` Ontje.Luensdorf
2022-12-02 13:13     ` bug#59177: " Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.