Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6BB7D18C96 for ; Tue, 25 Aug 2015 16:44:46 +0000 (UTC) Received: (qmail 79696 invoked by uid 500); 25 Aug 2015 16:44:46 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 79660 invoked by uid 500); 25 Aug 2015 16:44:46 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 79646 invoked by uid 99); 25 Aug 2015 16:44:46 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2015 16:44:46 +0000 Date: Tue, 25 Aug 2015 16:44:46 +0000 (UTC) From: "Ariel Weisberg (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-8684) Replace usage of Adler32 with CRC32 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CASSANDRA-8684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14711601#comment-14711601 ] Ariel Weisberg commented on CASSANDRA-8684: ------------------------------------------- I didn't try allocation profiling. I didn't think it would show up. None of them should allocate on heap. I imagine that the old JNI versions would end up having to copy for large allocations, but that would be off heap. The rest should process the data in place. > Replace usage of Adler32 with CRC32 > ----------------------------------- > > Key: CASSANDRA-8684 > URL: https://issues.apache.org/jira/browse/CASSANDRA-8684 > Project: Cassandra > Issue Type: Improvement > Components: Core > Reporter: Ariel Weisberg > Assignee: Ariel Weisberg > Fix For: 3.0 beta 1 > > Attachments: CRCBenchmark.java, PureJavaCrc32.java, Sample.java > > > I could not find a situation in which Adler32 outperformed PureJavaCrc32 much less the intrinsic from Java 8. For small allocations PureJavaCrc32 was much faster probably due to the JNI overhead of invoking the native Adler32 implementation where the array has to be allocated and copied. > I tested on a 65w Sandy Bridge i5 running Ubuntu 14.04 with JDK 1.7.0_71 as well as a c3.8xlarge running Ubuntu 14.04. > I think it makes sense to stop using Adler32 when generating new checksums. > c3.8xlarge, results are time in milliseconds, lower is better > ||Allocation size|Adler32|CRC32|PureJavaCrc32|| > |64|47636|46075|25782| > |128|36755|36712|23782| > |256|31194|32211|22731| > |1024|27194|28792|22010| > |1048576|25941|27807|21808| > |536870912|25957|27840|21836| > i5 > ||Allocation size|Adler32|CRC32|PureJavaCrc32|| > |64|50539|50466|26826| > |128|37092|38533|24553| > |256|30630|32938|23459| > |1024|26064|29079|22592| > |1048576|24357|27911|22481| > |536870912|24838|28360|22853| > Another fun fact. Performance of the CRC32 intrinsic appears to double from Sandy Bridge -> Haswell. Unless I am measuring something different when going from Linux/Sandy to Haswell/OS X. > The intrinsic/JDK 8 implementation also operates against DirectByteBuffers better and coding against the wrapper will get that boost when run with Java 8. -- This message was sent by Atlassian JIRA (v6.3.4#6332)