Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E4F4E200D0F for ; Thu, 14 Sep 2017 14:05:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E19B71609CC; Thu, 14 Sep 2017 12:05:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 38FE71609CD for ; Thu, 14 Sep 2017 14:05:06 +0200 (CEST) Received: (qmail 53481 invoked by uid 500); 14 Sep 2017 12:05:04 -0000 Mailing-List: contact issues-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@spark.apache.org Received: (qmail 53472 invoked by uid 99); 14 Sep 2017 12:05:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Sep 2017 12:05:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 3AC66DC4E3 for ; Thu, 14 Sep 2017 12:05:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ZHK04298cbcm for ; Thu, 14 Sep 2017 12:05:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 4A70E5FC21 for ; Thu, 14 Sep 2017 12:05:03 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B7EBAE0EE9 for ; Thu, 14 Sep 2017 12:05:02 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 78D9425382 for ; Thu, 14 Sep 2017 12:05:01 +0000 (UTC) Date: Thu, 14 Sep 2017 12:05:01 +0000 (UTC) From: =?utf-8?Q?Maciej_Bry=C5=84ski_=28JIRA=29?= To: issues@spark.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (SPARK-22010) Slow fromInternal conversion for TimestampType MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 14 Sep 2017 12:05:07 -0000 [ https://issues.apache.org/jira/browse/SPARK-22010?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D161= 66136#comment-16166136 ]=20 Maciej Bry=C5=84ski commented on SPARK-22010: ---------------------------------------- The reason of this Jira is this profiling (attachment). As you can see about 80% of pyspark time is spent in Spark internals. > Slow fromInternal conversion for TimestampType > ---------------------------------------------- > > Key: SPARK-22010 > URL: https://issues.apache.org/jira/browse/SPARK-22010 > Project: Spark > Issue Type: Bug > Components: PySpark > Affects Versions: 2.2.0 > Reporter: Maciej Bry=C5=84ski > > To convert timestamp type to python we are using=20 > `datetime.datetime.fromtimestamp(ts // 1000000).replace(microsecond=3Dts = % 1000000)` > code. > {code} > In [34]: %%timeit > ...: datetime.datetime.fromtimestamp(1505383647).replace(microsecond= =3D12344) > ...: > 4.2 =C2=B5s =C2=B1 558 ns per loop (mean =C2=B1 std. dev. of 7 runs, 1000= 00 loops each) > {code} > It's slow, because: > # we're trying to get TZ on every conversion > # we're using replace method > Proposed solution: custom datetime conversion and move calculation of TZ = to module -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org For additional commands, e-mail: issues-help@spark.apache.org