From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1197C1F51A for ; Sun, 24 Mar 2024 00:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yhbt.net; s=selector1; t=1711239559; bh=dPI5DwlIB1Pf78ufyK337UTccwTpwLzpszCDBNaeYs0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=0scMFHRlYGvmjCdMsbZ/jYcXAL7gTyZipZiTpDeEcBSjoSHQrDb7UcS32biXCZyNT WIVDehvSw/cNutapOmBPHFWkQxWOjIwuI82jrULxxlFX6IdXlAKTFiVDzuUQj/QkLF Z4+2GzYFXJoLl1uaYzEiIIUqvb7LHCycUHqoROww= From: Eric Wong To: raindrops-public@yhbt.net Subject: [PATCH 1/2] linux_inet_diag: remove needless OBJ_FREEZE calls Date: Sun, 24 Mar 2024 00:19:17 +0000 Message-ID: <20240324001918.1644612-2-bofh@yhbt.net> In-Reply-To: <20240324001918.1644612-1-bofh@yhbt.net> References: <20240324001918.1644612-1-bofh@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: OBJ_FREEZE before calling rb_hash_aset was actually preventing deduplication since Ruby 2.6. This introduces a performance regression for Ruby 2.5 users, but I expect the majority of users are on newer versions (I'm on 2.7, which is still ancient). --- ext/raindrops/linux_inet_diag.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/raindrops/linux_inet_diag.c b/ext/raindrops/linux_inet_diag.c index e4050cb..799b4da 100644 --- a/ext/raindrops/linux_inet_diag.c +++ b/ext/raindrops/linux_inet_diag.c @@ -159,7 +159,6 @@ static int st_to_hash(st_data_t key, st_data_t value, VALUE hash) VALUE k = remove_scope_id((const char *)key); VALUE v = rb_listen_stats(stats); - OBJ_FREEZE(k); rb_hash_aset(hash, k, v); } return st_free_data(key, value, 0); @@ -174,7 +173,6 @@ static int st_AND_hash(st_data_t key, st_data_t value, VALUE hash) if (rb_hash_lookup(hash, k) == Qtrue) { VALUE v = rb_listen_stats(stats); - OBJ_FREEZE(k); rb_hash_aset(hash, k, v); } }