unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Suggest: Byte-Compile package-quickstart on a separate thread?
@ 2020-12-28 14:49 T.V Raman
  2020-12-28 16:31 ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: T.V Raman @ 2020-12-28 14:49 UTC (permalink / raw)
  To: emacs-devel

The faster startup is nice, but one consequence of byte-compiling
package-quickstart after package updates is that emacs blocks for a
while. I myself use package paradox which already does the
download/unpack asynchronously; could we also move the
byte-compilation of package-quickstart to a separate thread?

-- 

Thanks,

--Raman
♉ Id: kg:/m/0285kf1  🦮

-- 

Thanks,

--Raman
♉ Id: kg:/m/0285kf1  🦮



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 14:49 Suggest: Byte-Compile package-quickstart on a separate thread? T.V Raman
@ 2020-12-28 16:31 ` Stefan Monnier
  2020-12-28 17:34   ` Stefan Kangas
  2020-12-28 18:26   ` T.V Raman via Emacs development discussions.
  0 siblings, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2020-12-28 16:31 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

> The faster startup is nice, but one consequence of byte-compiling
> package-quickstart after package updates is that emacs blocks for a
> while. I myself use package paradox which already does the
> download/unpack asynchronously; could we also move the
> byte-compilation of package-quickstart to a separate thread?

Sounds like a good idea, but you forgot to attach the patch to
your message.


        Stefan ;-)




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 16:31 ` Stefan Monnier
@ 2020-12-28 17:34   ` Stefan Kangas
  2020-12-28 18:26   ` T.V Raman via Emacs development discussions.
  1 sibling, 0 replies; 11+ messages in thread
From: Stefan Kangas @ 2020-12-28 17:34 UTC (permalink / raw)
  To: Stefan Monnier, T.V Raman; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> The faster startup is nice, but one consequence of byte-compiling
>> package-quickstart after package updates is that emacs blocks for a
>> while. I myself use package paradox which already does the
>> download/unpack asynchronously; could we also move the
>> byte-compilation of package-quickstart to a separate thread?
>
> Sounds like a good idea,

Agreed.  I'd suggest sending a feature request to the bug tracker so we
don't forget about it.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 16:31 ` Stefan Monnier
  2020-12-28 17:34   ` Stefan Kangas
@ 2020-12-28 18:26   ` T.V Raman via Emacs development discussions.
  2020-12-28 18:38     ` T.V Raman
  1 sibling, 1 reply; 11+ messages in thread
From: T.V Raman via Emacs development discussions. @ 2020-12-28 18:26 UTC (permalink / raw)
  To: monnier; +Cc: emacs-devel, raman


Haven't written the patch yet;-)Stefan Monnier writes:
 > > The faster startup is nice, but one consequence of byte-compiling
 > > package-quickstart after package updates is that emacs blocks for a
 > > while. I myself use package paradox which already does the
 > > download/unpack asynchronously; could we also move the
 > > byte-compilation of package-quickstart to a separate thread?
 > 
 > Sounds like a good idea, but you forgot to attach the patch to
 > your message.
 > 
 > 
 >         Stefan ;-)

-- 
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 18:26   ` T.V Raman via Emacs development discussions.
@ 2020-12-28 18:38     ` T.V Raman
  2020-12-28 19:19       ` Eli Zaretskii
  2020-12-28 20:34       ` Andrea Corallo via Emacs development discussions.
  0 siblings, 2 replies; 11+ messages in thread
From: T.V Raman @ 2020-12-28 18:38 UTC (permalink / raw)
  To: T.V Raman via Emacs development discussions.; +Cc: monnier

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1305 bytes --]

"T.V Raman" via "Emacs development discussions." <emacs-devel@gnu.org>
writes:
Here's a small patch  that uses make-thread:

git diff package.el
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index bc450b09d0..104c2d8e71 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4108,7 +4108,7 @@ package-quickstart-refresh
 ;; no-update-autoloads: t
 ;; End:
 "))
-    (byte-compile-file package-quickstart-file)))
+    (make-thread #'byte-compile-file package-quickstart-file)))
 
 (defun package--imenu-prev-index-position-function ()
   "Move point to previous line in package-menu buffer.

> Haven't written the patch yet;-)Stefan Monnier writes:
>  > > The faster startup is nice, but one consequence of byte-compiling
>  > > package-quickstart after package updates is that emacs blocks for a
>  > > while. I myself use package paradox which already does the
>  > > download/unpack asynchronously; could we also move the
>  > > byte-compilation of package-quickstart to a separate thread?
>  > 
>  > Sounds like a good idea, but you forgot to attach the patch to
>  > your message.
>  > 
>  > 
>  >         Stefan ;-)
>
> -- 
> 7©4Id: kg:/m/0285kf1  •0Ü87©4

-- 

Thanks,

--Raman
7©4 Id: kg:/m/0285kf1  •0Ü8



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 18:38     ` T.V Raman
@ 2020-12-28 19:19       ` Eli Zaretskii
  2020-12-28 19:52         ` T.V Raman via Emacs development discussions.
  2020-12-28 20:34       ` Andrea Corallo via Emacs development discussions.
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2020-12-28 19:19 UTC (permalink / raw)
  To: T.V Raman; +Cc: monnier, emacs-devel

> From: "T.V Raman" <raman@google.com>
> Date: Mon, 28 Dec 2020 10:38:01 -0800
> Cc: monnier@iro.umontreal.ca
> 
> "T.V Raman" via "Emacs development discussions." <emacs-devel@gnu.org>
> writes:
> Here's a small patch  that uses make-thread:
> 
> git diff package.el
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index bc450b09d0..104c2d8e71 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4108,7 +4108,7 @@ package-quickstart-refresh
>  ;; no-update-autoloads: t
>  ;; End:
>  "))
> -    (byte-compile-file package-quickstart-file)))
> +    (make-thread #'byte-compile-file package-quickstart-file)))

I'm not sure it can be done so easily: byte-compile-file sometimes
needs to interact with the user, and that might not work or not do
what you expect when run from a separate thread.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 19:19       ` Eli Zaretskii
@ 2020-12-28 19:52         ` T.V Raman via Emacs development discussions.
  2020-12-28 19:58           ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: T.V Raman via Emacs development discussions. @ 2020-12-28 19:52 UTC (permalink / raw)
  To: eliz; +Cc: emacs-devel, monnier, raman

I dont think I've seen byte-compile interact with the user, what use
cases does that happen in?



Eli Zaretskii writes:
 > > From: "T.V Raman" <raman@google.com>
 > > Date: Mon, 28 Dec 2020 10:38:01 -0800
 > > Cc: monnier@iro.umontreal.ca
 > > 
 > > "T.V Raman" via "Emacs development discussions." <emacs-devel@gnu.org>
 > > writes:
 > > Here's a small patch  that uses make-thread:
 > > 
 > > git diff package.el
 > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
 > > index bc450b09d0..104c2d8e71 100644
 > > --- a/lisp/emacs-lisp/package.el
 > > +++ b/lisp/emacs-lisp/package.el
 > > @@ -4108,7 +4108,7 @@ package-quickstart-refresh
 > >  ;; no-update-autoloads: t
 > >  ;; End:
 > >  "))
 > > -    (byte-compile-file package-quickstart-file)))
 > > +    (make-thread #'byte-compile-file package-quickstart-file)))
 > 
 > I'm not sure it can be done so easily: byte-compile-file sometimes
 > needs to interact with the user, and that might not work or not do
 > what you expect when run from a separate thread.

-- 
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 19:52         ` T.V Raman via Emacs development discussions.
@ 2020-12-28 19:58           ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2020-12-28 19:58 UTC (permalink / raw)
  To: T.V Raman; +Cc: monnier, emacs-devel

> From: "T.V Raman" <raman@google.com>
> Date: Mon, 28 Dec 2020 11:52:10 -0800
> Cc: raman@google.com,
>     emacs-devel@gnu.org,
>     monnier@iro.umontreal.ca
> 
> I dont think I've seen byte-compile interact with the user, what use
> cases does that happen in?

One case is if the user customized byte-compile-generate-call-tree to
a non-nil, non-t value.

Another case is when package-quickstart was somehow modified by the
time you invoke this.

And there could be others, I didn't look into all the functions and
subroutines it calls.  In general, interactive commands expect to be
able to communicate with the user, and so running them in another
thread could be problematic.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 18:38     ` T.V Raman
  2020-12-28 19:19       ` Eli Zaretskii
@ 2020-12-28 20:34       ` Andrea Corallo via Emacs development discussions.
  2020-12-28 21:50         ` T.V Raman via Emacs development discussions.
  1 sibling, 1 reply; 11+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2020-12-28 20:34 UTC (permalink / raw)
  To: T.V Raman; +Cc: monnier, T.V Raman via Emacs development discussions.

"T.V Raman" <raman@google.com> writes:

> "T.V Raman" via "Emacs development discussions." <emacs-devel@gnu.org>
> writes:
> Here's a small patch  that uses make-thread:
>
> git diff package.el
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index bc450b09d0..104c2d8e71 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4108,7 +4108,7 @@ package-quickstart-refresh
>  ;; no-update-autoloads: t
>  ;; End:
>  "))
> -    (byte-compile-file package-quickstart-file)))
> +    (make-thread #'byte-compile-file package-quickstart-file)))

I think this patch might have also the following two issues:

- Doing intense computation in a Lisp thread usually make the system
  extremely unresponsive, and it does it certanly if the code does not
  yield.  As the byte compiler never yields the 'blocking' effect should
  be the same as running in the main thread, this because this Lisp
  thread is never preempted.

- What about if the file being compiled is loaded before the byte
  compilation is completed?  This is another tricky part that has to be
  addressed (as we had to do in the native compiler).

Regards

  Andrea



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 20:34       ` Andrea Corallo via Emacs development discussions.
@ 2020-12-28 21:50         ` T.V Raman via Emacs development discussions.
  2020-12-28 23:47           ` arthur miller
  0 siblings, 1 reply; 11+ messages in thread
From: T.V Raman via Emacs development discussions. @ 2020-12-28 21:50 UTC (permalink / raw)
  To: akrl; +Cc: emacs-devel, monnier, raman

I buy your first argument. The second not so much so though it's moot
given the first argument.
Andrea Corallo writes:
 > "T.V Raman" <raman@google.com> writes:
 > 
 > > "T.V Raman" via "Emacs development discussions." <emacs-devel@gnu.org>
 > > writes:
 > > Here's a small patch  that uses make-thread:
 > >
 > > git diff package.el
 > >
 > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
 > > index bc450b09d0..104c2d8e71 100644
 > > --- a/lisp/emacs-lisp/package.el
 > > +++ b/lisp/emacs-lisp/package.el
 > > @@ -4108,7 +4108,7 @@ package-quickstart-refresh
 > >  ;; no-update-autoloads: t
 > >  ;; End:
 > >  "))
 > > -    (byte-compile-file package-quickstart-file)))
 > > +    (make-thread #'byte-compile-file package-quickstart-file)))
 > 
 > I think this patch might have also the following two issues:
 > 
 > - Doing intense computation in a Lisp thread usually make the system
 >   extremely unresponsive, and it does it certanly if the code does not
 >   yield.  As the byte compiler never yields the 'blocking' effect should
 >   be the same as running in the main thread, this because this Lisp
 >   thread is never preempted.
 > 
 > - What about if the file being compiled is loaded before the byte
 >   compilation is completed?  This is another tricky part that has to be
 >   addressed (as we had to do in the native compiler).
 > 
 > Regards
 > 
 >   Andrea

-- 
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉



^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Suggest: Byte-Compile package-quickstart on a separate thread?
  2020-12-28 21:50         ` T.V Raman via Emacs development discussions.
@ 2020-12-28 23:47           ` arthur miller
  0 siblings, 0 replies; 11+ messages in thread
From: arthur miller @ 2020-12-28 23:47 UTC (permalink / raw)
  To: T.V Raman, akrl@sdf.org; +Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2196 bytes --]

Since byte compiled quickstart file is  there just to speed up Emacs startup time a bit, it is well, not of some crucial importance to byte-compile it immediately. Isn't an idle-timer sufficient? Just so it gets it compiled at some-time before Emacs starts again. And if compilation fails Emacs can output a message to *Messages* buffer. Would that be sufficient?


-------- Originalmeddelande --------
Från: "T.V Raman via Emacs development discussions." <emacs-devel@gnu.org>
Datum: 2020-12-28 22:52 (GMT+01:00)
Till: akrl@sdf.org
Kopia: emacs-devel@gnu.org, monnier@iro.umontreal.ca, raman@google.com
Ämne: Re: Suggest: Byte-Compile package-quickstart on a separate thread?

I buy your first argument. The second not so much so though it's moot
given the first argument.
Andrea Corallo writes:
 > "T.V Raman" <raman@google.com> writes:
 >
 > > "T.V Raman" via "Emacs development discussions." <emacs-devel@gnu.org>
 > > writes:
 > > Here's a small patch  that uses make-thread:
 > >
 > > git diff package.el
 > >
 > > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
 > > index bc450b09d0..104c2d8e71 100644
 > > --- a/lisp/emacs-lisp/package.el
 > > +++ b/lisp/emacs-lisp/package.el
 > > @@ -4108,7 +4108,7 @@ package-quickstart-refresh
 > >  ;; no-update-autoloads: t
 > >  ;; End:
 > >  "))
 > > -    (byte-compile-file package-quickstart-file)))
 > > +    (make-thread #'byte-compile-file package-quickstart-file)))
 >
 > I think this patch might have also the following two issues:
 >
 > - Doing intense computation in a Lisp thread usually make the system
 >   extremely unresponsive, and it does it certanly if the code does not
 >   yield.  As the byte compiler never yields the 'blocking' effect should
 >   be the same as running in the main thread, this because this Lisp
 >   thread is never preempted.
 >
 > - What about if the file being compiled is loaded before the byte
 >   compilation is completed?  This is another tricky part that has to be
 >   addressed (as we had to do in the native compiler).
 >
 > Regards
 >
 >   Andrea

--
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉


[-- Attachment #2: Type: text/html, Size: 3499 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-12-28 23:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-28 14:49 Suggest: Byte-Compile package-quickstart on a separate thread? T.V Raman
2020-12-28 16:31 ` Stefan Monnier
2020-12-28 17:34   ` Stefan Kangas
2020-12-28 18:26   ` T.V Raman via Emacs development discussions.
2020-12-28 18:38     ` T.V Raman
2020-12-28 19:19       ` Eli Zaretskii
2020-12-28 19:52         ` T.V Raman via Emacs development discussions.
2020-12-28 19:58           ` Eli Zaretskii
2020-12-28 20:34       ` Andrea Corallo via Emacs development discussions.
2020-12-28 21:50         ` T.V Raman via Emacs development discussions.
2020-12-28 23:47           ` arthur miller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).