From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Long lines and bidi Date: Fri, 08 Feb 2013 16:46:13 +0200 Message-ID: <836222983u.fsf@gnu.org> References: <877gmp5a04.fsf@ed.ac.uk> <83vca89izh.fsf@gnu.org> <5110906D.7020406@yandex.ru> <83fw1aac3d.fsf@gnu.org> <51120360.4060104@yandex.ru> <51127363.5030203@yandex.ru> <834nhp9u9j.fsf@gnu.org> <5114FEBB.8020201@yandex.ru> <838v6y99wk.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1360334759 19196 80.91.229.3 (8 Feb 2013 14:45:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 8 Feb 2013 14:45:59 +0000 (UTC) Cc: emacs-devel@gnu.org To: dmantipov@yandex.ru Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 08 15:46:20 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U3pDY-00008K-Af for ged-emacs-devel@m.gmane.org; Fri, 08 Feb 2013 15:46:20 +0100 Original-Received: from localhost ([::1]:58867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3pDF-0004hS-Ay for ged-emacs-devel@m.gmane.org; Fri, 08 Feb 2013 09:46:01 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3pDC-0004gr-Pi for emacs-devel@gnu.org; Fri, 08 Feb 2013 09:46:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3pDA-00011y-N7 for emacs-devel@gnu.org; Fri, 08 Feb 2013 09:45:58 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:40995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3pDA-00011G-FC for emacs-devel@gnu.org; Fri, 08 Feb 2013 09:45:56 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MHW00L00OHM8R00@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Fri, 08 Feb 2013 16:45:54 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MHW00KSPP0IXIC0@a-mtaout20.012.net.il>; Fri, 08 Feb 2013 16:45:54 +0200 (IST) In-reply-to: <838v6y99wk.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156886 Archived-At: > Date: Fri, 08 Feb 2013 16:07:23 +0200 > From: Eli Zaretskii > Cc: emacs-devel@gnu.org > > Profile alone is not enough. Please tell how did you "scroll", > exactly (which commands did you use), and please also show the > absolute times it took to perform each command. Btw, if you are serious about finding a solution to the long-line display misfeature (or any other too-slow redisplay situation), I generally find it necessary to do precision timing of the suspicious parts of code, because otherwise it is impossible to find the actual culprits. On GNU/Linux, I use the following simple function: double timer_time (void) { struct timeval tv; gettimeofday (&tv, NULL); return tv.tv_usec * 0.000001 + tv.tv_sec; } Now, to time a particular portion of the code, do something like this: double t1, t2; ... t1 = timer_time (); /* here comes the code that should be timed */ t2 = timer_time (); if (t2 - t1 > THRESHOLD) fprintf (stderr, "that code took %.4g sec\n", t2 - t1); The value of THRESHOLD depends on the magnitude of the slow-down you are working on. I generally start with 0.1 of the time it takes to perform some redisplay operation; e.g., if it takes 5 sec to move the cursor, start with 0.5 sec. gettimeofday has a sufficient resolution on GNU/Linux to get you sub-millisecond accuracy, which is more than enough for display engine measurements. Using the above, you can quickly identify the function(s) that take most of the time of a particular redisplay operation, then time the parts of those functions to find the most expensive parts, and so on, recursively, until you find the hot spots (more than 50% of the slow operation).