From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alex Gramiak Newsgroups: gmane.emacs.devel Subject: Re: NS port: How to debug excessive garbage collection? Date: Sun, 14 Apr 2019 21:44:41 -0600 Message-ID: <871s24sziu.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="84658"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: eliz@gnu.org, dancol@dancol.org, emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Apr 15 05:45:19 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFsYZ-000Lvt-18 for ged-emacs-devel@m.gmane.org; Mon, 15 Apr 2019 05:45:19 +0200 Original-Received: from localhost ([127.0.0.1]:44145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFsYX-0000do-U1 for ged-emacs-devel@m.gmane.org; Sun, 14 Apr 2019 23:45:17 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFsXz-0000dj-VR for emacs-devel@gnu.org; Sun, 14 Apr 2019 23:44:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFsXz-0008EX-0m for emacs-devel@gnu.org; Sun, 14 Apr 2019 23:44:43 -0400 Original-Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:46107) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hFsXy-0008EQ-LS; Sun, 14 Apr 2019 23:44:42 -0400 Original-Received: by mail-pl1-x62f.google.com with SMTP id y6so7840190pll.13; Sun, 14 Apr 2019 20:44:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=1g0iEj24ZOCNV5FplErW6unAAVAExsi5J/WgKRmLdtQ=; b=dabvFWNfBUBhAXtlsFcdwzAFy/b576yQAxvLePFBMxRnjRQd+OnRdEYOMzs3drB4BQ P/IvL2ki/+VuZ2n73kWcqPnMeCT5W4semMQPNsWmZWX2zt93QHD7r8mIOvw7frYtWe3o 3KWP7iydgRB3WkXsfSZkepmJEQHJ/5t75SjBmYRW8c5nTXQKAKufukXo2of3lMOc80HL yDqobewISf7HnBeM7Te95TFHTsJW7+wChiprGGvPUE0/naJlcYUQLAuTXxG1hgmzmlZe HFjUEKAdqs5u9FUAXxaqlTz1S3zy+hhEwjm8SotV4uQd7HY6Zt1Mqj+gHcdf3OIw7ZYj 9AyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=1g0iEj24ZOCNV5FplErW6unAAVAExsi5J/WgKRmLdtQ=; b=t0+OWfe0KMNWeDklZXoQn3Rew0sX3aZNFq455zab4FmTuyDhFlY9fh8zdVqmqDtaoX HHJBzQPHDx8dYLVodLY2qo05Ur4iwWce3TSOjsw9Gl3KhZoo2dMC2+jHd0KztR5BeFZF sEA+qbITbaTmHJGdvayI9r1nfmQbpZArfYyGUwx+gqQSDQmivrmlIbH/7sa9i7mFptTf v6TGtK99DHhbLJNi9Bu6zPdmxEOMIof0cBLyFznxnto4pCyrCTtJx7Oej4gKz4VCM6+f o86udSXXO+9poT1nA1GubAdrSwL/7glhXaiifD07PY40/YoV3ekj1PRhyi3n5R8XVibY S7HQ== X-Gm-Message-State: APjAAAV4Lyyo3z5nfoK2CokkzhnZ5eyP/h6WMCmzovx+Ae5t7eMNfZ2O J68blJXpk1Rr/YlmqFnlEKol/kvd X-Google-Smtp-Source: APXvYqwrpAa1Kf7daeVlitbjDZ+eQvvwHli+ylFiHo28Apsl0ugS+bloCm5a3CAAhy4go2aCQXhI4g== X-Received: by 2002:a17:902:2aeb:: with SMTP id j98mr6072151plb.38.1555299881007; Sun, 14 Apr 2019 20:44:41 -0700 (PDT) Original-Received: from lylat ([2604:3d09:e37f:1500:1a72:4878:e793:7302]) by smtp.gmail.com with ESMTPSA id p7sm84720934pfp.70.2019.04.14.20.44.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 20:44:40 -0700 (PDT) In-Reply-To: (Keith David Bershatsky's message of "Sun, 14 Apr 2019 19:55:46 -0700") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235472 Archived-At: Keith David Bershatsky writes: > Thank you, Alex ... I like the idea of not using a Lisp_Object to store the > various window caches of fake cursors, as this would entirely eliminate the > garbage collection issues. Inasmuch as this would be my first usage of an array > in the world of programming, some guidance regarding the best way to initialize > the array (window cache) would be greatly appreciated. Sorry, I shouldn't have said to use a C array in this case. A struct would be better in this case due to the different types involved. > I saw three types of arrays: an array matching an exact size known in advance; > an array that is defined with a specified MAX_ROW / MAX_COL (some rows/columns > may never be used); and, an array using dynamic allocation with malloc, realloc > and free. Right. > Each window cache should be able to handle up to 250 fake cursors. Is 250 an arbitrary limit? > How do you recommend that the array for each window cache be initialized? > > 1. int x > 2. int fx > 3. int y > 4. int fy > 5. int hpos > 6. int vpos > 7. int wd > 8. int h > 9. int cursor_type > 10. int cursor_width > 11. double foreground_red > 12. double foreground_green > 13. double foreground_blue > 14. double background_red > 15. double background_green > 16. double background_blue > 17. bool active_p > 18. int glyph_flavor To change it to a struct (with a helper struct): struct RGB { double red; double green; double blue; }; struct multiple_cursor_cache { int x; int fx; int y; int fy; int hpos; int vpos; int wd; int h; int cursor_type; int cursor_width; struct RGB foreground; struct RGB background; bool active_p; int glyph_flavor; }; Then you have: struct multiple_cursor_cache mc_cache; and to set elements: w->mc_cache.x = x; w->mc_cache.foreground.red = red; To set all elements to zero, one does: memset (&variable, 0, sizeof (variable));