<!-- Automatically generated by emacsconf-publish-after-page --> <a name="gc-mainVideo-transcript"></a> # Transcript [[!template new="1" text="""Introduction""" start="00:00:00.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""Hello everyone, my name is Ihor Radchenko,""" start="00:00:00.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you may know me from Org Mailing List.""" start="00:00:04.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""However, today I'm not going to talk about Org Mode.""" start="00:00:07.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""Today I'm going to talk about""" start="00:00:09.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""Emacs performance and how it's affected""" start="00:00:11.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""by its memory management code.""" start="00:00:14.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""First, I will introduce the basic concepts""" start="00:00:19.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""of Emacs memory management and what garbage collection is.""" start="00:00:21.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""Then I will show you user statistics""" start="00:00:26.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""collected from volunteer users over the last half year""" start="00:00:30.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""and I will end with some guidelines""" start="00:00:34.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""on how to tweak Emacs garbage collection customizations""" start="00:00:39.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""to optimize Emacs performance""" start="00:00:44.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""and when it's necessary or not to do.""" start="00:00:47.480" video="mainVideo-gc" id="subtitle"]] [[!template new="1" text="""About garbage collection in Emacs""" start="00:00:51.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""Let's begin. What is garbage collection?""" start="00:00:51.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""To understand what is garbage collection,""" start="00:00:54.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""we need to realize that anything you do in Emacs""" start="00:00:56.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""is some kind of command. Any command is most likely""" start="00:00:59.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""running some Elisp code. Every time you run Elisp code,""" start="00:01:02.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""you most likely need to locate certain memory in RAM.""" start="00:01:05.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""Some of this memory is retained for a long time""" start="00:01:09.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""and some of this memory is transient.""" start="00:01:12.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""Of course, Emacs has to clear this transient memory""" start="00:01:15.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""from time to time, to not occupy all the possible RAM""" start="00:01:19.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""in the computer. In this small example,""" start="00:01:21.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""we have one global variable""" start="00:01:21.448" video="mainVideo-gc" id="subtitle"]] [[!template text="""that is assigned a value,""" start="00:01:28.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""but when assigning the value,""" start="00:01:31.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""we first allocate a temporary variable""" start="00:01:33.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then a temporary list""" start="00:01:35.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""and only retain some part of this list""" start="00:01:37.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""in this global variable.""" start="00:01:40.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""In terms of memory graph""" start="00:01:42.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""we can represent this as two variable slots,""" start="00:01:44.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""one transient, one permanent,""" start="00:01:50.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then a list of three cons cells,""" start="00:01:53.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""part of which is retained as a global variable""" start="00:01:56.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""but part of it which is a temporary variable symbol.""" start="00:02:01.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""The first term of the list is not used""" start="00:02:05.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""and it might be cleared at some point.""" start="00:02:07.680" video="mainVideo-gc" id="subtitle"]] [[!template new="1" text="""Garbage collection in Emacs""" start="00:02:09.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""So that's what Emacs does.""" start="00:02:09.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""Every now and then, Emacs goes through all the memory""" start="00:02:12.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""and identifies which part of the memory are not used""" start="00:02:15.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then clear them so that it can free up the RAM.""" start="00:02:19.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""This process is called garbage collection""" start="00:02:23.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""and Emacs uses a very simple and old algorithm""" start="00:02:25.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is called Mark & Sweep.""" start="00:02:28.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""So doing this mark and sweep process""" start="00:02:30.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""is basically two stages.""" start="00:02:33.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""First, Emacs scans all the memory that is allocated""" start="00:02:34.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then identifies which memory is still in use""" start="00:02:40.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is linked to some variables, for example,""" start="00:02:42.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""and which memory is not used anymore""" start="00:02:45.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""even though it was allocated in the past.""" start="00:02:47.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""The second stage [??] whenever a memory is not,""" start="00:02:49.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""that is not allocated. During the process""" start="00:02:53.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""Emacs cannot do anything now.""" start="00:02:59.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""So basically, every time Emacs scans the memory,""" start="00:03:00.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""it freezes up and doesn't respond to anything,""" start="00:03:04.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""and if it takes too much time so that users can notice it,""" start="00:03:07.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""then of course Emacs is not responsive at all,""" start="00:03:10.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""and if this garbage collection is triggered too frequently,""" start="00:03:13.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""then it's not just not responsive every now and then.""" start="00:03:19.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""It's also not responsive all the time,""" start="00:03:22.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""almost all the time,""" start="00:03:24.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""so it cannot even normally type or stuff""" start="00:03:26.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""or do some normal commands.""" start="00:03:27.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""This mark and sweep algorithm is taking longer""" start="00:03:32.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""the more memory Emacs uses. So basically,""" start="00:03:36.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""the more buffers you open, the more packages you load,""" start="00:03:40.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""the more complex commands you run, the more memory is used,""" start="00:03:44.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""and basically, the longer Emacs takes""" start="00:03:48.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""to perform a single garbage collection.""" start="00:03:52.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""Of course, Emacs being Emacs""" start="00:03:57.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""this garbage collection can be tweaked.""" start="00:04:02.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""In particular users can tweak""" start="00:04:06.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""how frequently Emacs does garbage collection""" start="00:04:08.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""using two basic variables: `gc-cons-threshold`""" start="00:04:10.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""and `gc-cons-percentage`.""" start="00:04:13.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""`gc-cons-threshold` is the raw number of kilobytes""" start="00:04:15.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""Emacs needs to allocate""" start="00:04:21.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""before triggering another garbage collection,""" start="00:04:22.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""and the `gc-cons-percentage` is similar,""" start="00:04:25.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""but it's defined in terms of fraction""" start="00:04:27.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""of already-allocated memory.""" start="00:04:30.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""If you follow various Emacs forums,""" start="00:04:34.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""you may be familiar with people complaining about""" start="00:04:38.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""garbage collection. There are many many suggestions""" start="00:04:41.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""about what to do with it.""" start="00:04:46.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""Most frequently, you see `gc-cons-threshold`""" start="00:04:48.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""recommended to be increased,""" start="00:04:54.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""and a number of pre-packaged Emacs distributions""" start="00:04:56.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""like Doom Emacs do increase it.""" start="00:05:01.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""I have seen suggestions which are actually horrible""" start="00:05:04.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""to disable garbage collection temporarily""" start="00:05:07.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""or for a long time.""" start="00:05:10.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""Which is nice... You can see it quite frequently,""" start="00:05:14.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""which indicates there might be some problem.""" start="00:05:17.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""However, every time one user poses about this problem,""" start="00:05:19.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's just one data point and it doesn't mean""" start="00:05:23.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""that everyone actually suffers from it.""" start="00:05:26.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""It doesn't mean that everyone should do it.""" start="00:05:28.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""So in order to understand if this garbage collection""" start="00:05:33.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""is really a problem which is a common problem""" start="00:05:35.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""we do need some kind of statistics""" start="00:05:39.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""and only using the actual statistics""" start="00:05:44.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""we can understand if it should be recommended for everyone""" start="00:05:46.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""to tweak the defaults or like whether""" start="00:05:52.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""it should be recommended for certain users""" start="00:05:55.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""or maybe it should be asked Emacs devs""" start="00:05:57.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""to do something about the defaults.""" start="00:05:59.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""And what I did some time ago is exactly this.""" start="00:06:01.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""I tried to collect the user statistics.""" start="00:06:07.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""So I wrote a small package on Elp""" start="00:06:09.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""and some users installed this package""" start="00:06:14.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then reported back these statistics""" start="00:06:18.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""of the garbage collection for their particular use.""" start="00:06:22.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""By now we have obtained 129 user submissions""" start="00:06:24.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""with over 1 million GC records in there.""" start="00:06:30.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""So like some of these submissions""" start="00:06:34.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""used default GC settings without any customizations.""" start="00:06:38.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""Some used increased GC cost threshold""" start="00:06:43.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""and GC cost percentage.""" start="00:06:46.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""So using this data we can try to draw""" start="00:06:47.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""some reliable conclusions on what should be done""" start="00:06:53.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""and whether should anything be done about garbage collection""" start="00:06:56.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""on Emacs dev level or at least on user level.""" start="00:06:59.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""Of course we need to keep in mind""" start="00:07:02.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""that there's some kind of bias""" start="00:07:05.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""because it's more likely""" start="00:07:07.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""that users already have problems with GC""" start="00:07:09.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""or they think they have problems with GC""" start="00:07:11.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""will report and submit the data.""" start="00:07:13.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""But anyway having s statistics is much more useful""" start="00:07:15.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""than just having anecdotal evidences""" start="00:07:20.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""from one or other reddit posts.""" start="00:07:22.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""And just one thing I will do""" start="00:07:25.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""during the rest of my presentation""" start="00:07:28.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""is that for all the statistics""" start="00:07:30.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""I will normalize user data""" start="00:07:32.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""so that every user contributes equally.""" start="00:07:35.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""For example if one user submits like""" start="00:07:37.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""100 hours Emacs uptime statistics""" start="00:07:40.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""and other users submit one hour Emacs uptime""" start="00:07:43.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""then I will anyway make it so that they contribute equally.""" start="00:07:46.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""Let's start from one of the most obvious things""" start="00:07:52.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""we can look into is""" start="00:07:56.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is the time it takes for garbage collection""" start="00:07:57.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""to single garbage collection process.""" start="00:08:00.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""Here you see frequency distribution of GC duration""" start="00:08:05.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""for all the 129 users we got""" start="00:08:11.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you can see that most of the garbage collections""" start="00:08:15.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""are done quite quickly in less than 0.1 second""" start="00:08:22.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""and less than 0.1 second is usually just not noticeable.""" start="00:08:27.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""So even though there is garbage collection""" start="00:08:32.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""it will not interrupt the work in Emacs.""" start="00:08:34.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""However there is a fraction of users""" start="00:08:39.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""who experience garbage collection""" start="00:08:43.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""it takes like 0.2, 0.3 or even half a second""" start="00:08:45.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""which will be quite noticeable.""" start="00:08:48.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""For the purposes of this study""" start="00:08:50.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""I will consider that anything that is less than 0.1 second""" start="00:08:55.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is insignificant so like you will not notice it""" start="00:08:59.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""and it's like obviously""" start="00:09:02.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""all the Emacs usage will be just normal.""" start="00:09:04.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""But if it's more than 0.1 or 0.2 seconds""" start="00:09:07.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""then it will be very noticeable""" start="00:09:11.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you will see that Emacs hang for a little while""" start="00:09:13.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""or not so little while. In terms of numbers""" start="00:09:16.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's better to plot the statistics not as a distribution""" start="00:09:21.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""but as a cumulative distribution.""" start="00:09:26.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""So like at every point of this graph""" start="00:09:28.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""you'll see like for example here 0.4 seconds""" start="00:09:31.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""you have this percent of like almost 90% of users""" start="00:09:37.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""have no more than 0.4 gc duration.""" start="00:09:42.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""So like we can look here if we take one""" start="00:09:49.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""gc critical gc duration which is 0.1 second""" start="00:09:53.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""0.1 second and look at how many users have""" start="00:09:56.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""it so we have 56% which is like""" start="00:10:00.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""44% users have less than 0.1 second gc duration""" start="00:10:02.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""and the rest 56% have more than 0.1 second.""" start="00:10:09.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""So you can see like more than half of users""" start="00:10:12.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""actually have noticeable gc delay""" start="00:10:16.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""so the Emacs freezes for some noticeable time""" start="00:10:20.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""and a quarter of users actually have very noticeable""" start="00:10:23.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""so like Emacs freezes such that you see an actual delay""" start="00:10:27.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""that Emacs actually has""" start="00:10:31.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is quite significant and important point.""" start="00:10:36.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""But apart from the duration of each individual gc""" start="00:10:44.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""it is important to see how frequent it is""" start="00:10:47.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""because even if you do notice a delay""" start="00:10:49.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""even a few seconds delay""" start="00:10:52.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""it doesn't matter if it happens once""" start="00:10:54.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""during the whole Emacs session.""" start="00:10:57.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""So if you look into frequency distribution again here""" start="00:10:59.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""I plot time between subsequent garbage collections""" start="00:11:05.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""versus how frequent it is and we have very clear trend""" start="00:11:13.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""that most of the garbage collections are quite frequent""" start="00:11:17.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""like we talk about every few seconds a few tens of seconds.""" start="00:11:21.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""There's a few outliers which are at very round numbers""" start="00:11:25.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""like 60 seconds, 120 seconds, 300 seconds.""" start="00:11:30.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""These are usually timers so like""" start="00:11:35.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""you have something running on timer""" start="00:11:37.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then it is complex command""" start="00:11:40.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""and it triggers garbage collection""" start="00:11:43.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""but it's not the majority.""" start="00:11:45.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""Again to run the numbers""" start="00:11:48.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's better to look into cumulative distribution""" start="00:11:51.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""and see that 50% of garbage collections""" start="00:11:53.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""are basically less than 10 seconds apart.""" start="00:11:56.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""And we can combine it with previous data""" start="00:11:58.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""and we look into whatever garbage collection""" start="00:12:02.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""takes less than 10 seconds from each other""" start="00:12:07.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""and also takes more than say 0.1 seconds.""" start="00:12:09.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""So and then we see that""" start="00:12:13.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""one quarter of all garbage collections""" start="00:12:15.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""are just noticeable and also frequent""" start="00:12:17.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""and 9% are not like""" start="00:12:21.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""more than 0.2% very noticeable and also frequent.""" start="00:12:23.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""So basically it constitutes Emacs freezing.""" start="00:12:27.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""So 9% of all the garbage collection Emacs freezing.""" start="00:12:30.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""Of course if you remember there is a bias""" start="00:12:33.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""but 9% is quite significant number.""" start="00:12:37.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""So garbage collection can really slow down things""" start="00:12:40.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""not for everyone but for significant fraction of users.""" start="00:12:44.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""Another thing I'd like to look into""" start="00:12:48.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""is what I call agglomerated GCs.""" start="00:12:52.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""What I mean by agglomerated is""" start="00:12:55.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""when you have one garbage collection""" start="00:12:57.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then another garbage immediately after it.""" start="00:13:00.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""So in terms of numbers I took""" start="00:13:03.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""every subsequent garbage collection""" start="00:13:05.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is either immediately after""" start="00:13:08.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""or no more than one second after each.""" start="00:13:10.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""So from point of view of users is like""" start="00:13:13.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""multiple garbage collection they add up together""" start="00:13:16.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""into one giant garbage collection.""" start="00:13:20.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""And if you look into numbers""" start="00:13:23.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""of how many agglomerated garbage collections there are""" start="00:13:25.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""you can see even numbers over 100.""" start="00:13:29.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""So 100 garbage collection going one after another.""" start="00:13:32.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""Even if you think about each garbage collection""" start="00:13:35.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""taking 0.1 second we look into 100 of them""" start="00:13:39.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's total 10 seconds.""" start="00:13:42.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""It's like Emacs hanging forever""" start="00:13:44.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""or like a significant number is also 10.""" start="00:13:46.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""So again this would be very annoying to meet such thing.""" start="00:13:53.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""How frequently does it happen?""" start="00:13:56.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""Again we can plot cumulative distribution""" start="00:13:57.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""and we see that 20 percent like 19 percent""" start="00:14:00.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""of all the garbage collection are at least two together""" start="00:14:03.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""and 8 percent like more than 10. So like you think about oh""" start="00:14:07.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""each garbage collection is not taking much time""" start="00:14:13.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""but when you have 10 of them yeah that becomes a problem.""" start="00:14:15.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""Another thing is to answer a question""" start="00:14:24.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""that some people complain about is that""" start="00:14:29.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""longer you use Emacs the slower Emacs become.""" start="00:14:32.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""Of course it may be caused by garbage collection""" start="00:14:35.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""and I wanted to look into how garbage collection time""" start="00:14:43.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""and other statistics,""" start="00:14:48.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""other parameters are evolving over time.""" start="00:14:49.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""And what I can see here is a cumulative distribution""" start="00:14:53.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""of GC duration for like first 10 minutes of Emacs uptime""" start="00:14:58.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""first 100 minutes first 1000 minutes.""" start="00:15:03.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""And if you look closer then you see""" start="00:15:06.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""that each individual garbage collection on average""" start="00:15:10.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""takes longer as you use Emacs longer.""" start="00:15:14.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""However this longer is not much it's like maybe 10 percent""" start="00:15:18.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""like basically garbage collection gets like""" start="00:15:24.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""slow Emacs down more as you use Emacs more but not much.""" start="00:15:29.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""So basically if you do you see Emacs""" start="00:15:34.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""being slower and slower over time""" start="00:15:38.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's probably not really garbage collection""" start="00:15:40.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""because it doesn't change too much.""" start="00:15:43.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""And if you look into time""" start="00:15:45.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""between individual garbage collections""" start="00:15:48.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you see that the time actually increases""" start="00:15:50.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""as you use Emacs longer which makes sense""" start="00:15:53.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""because initially like first few minutes""" start="00:15:56.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""you have all kind of packages loading""" start="00:15:58.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""like all the port loading and then later""" start="00:16:01.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""everything is loaded and things become more stable.""" start="00:16:04.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""So the conclusion on this part is that""" start="00:16:07.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""if Emacs becomes slower in a long session""" start="00:16:12.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's probably not caused by garbage collection.""" start="00:16:16.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""And one word of warning of course is that""" start="00:16:18.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's all nice and all when I present the statistics""" start="00:16:23.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""but it's only an average""" start="00:16:27.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""and if you are an actual user like here is one example""" start="00:16:29.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""which shows a total garbage collection time""" start="00:16:34.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""like accumulated together over Emacs uptime""" start="00:16:37.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you see different lines""" start="00:16:40.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""which correspond to different sessions of one user""" start="00:16:43.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you see they are wildly different""" start="00:16:45.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""like one time there is almost no garbage collection""" start="00:16:48.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""another time you see garbage collection""" start="00:16:51.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""because probably Emacs is used more early""" start="00:16:54.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""or like different pattern of usage""" start="00:16:57.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""and even during a single Emacs session""" start="00:16:59.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""you see a different slope""" start="00:17:03.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""of this curve which means that""" start="00:17:04.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""sometimes garbage collection is infrequent""" start="00:17:06.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""and sometimes it's much more frequent""" start="00:17:09.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""so it's probably much more noticeable one time""" start="00:17:11.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""and less noticeable other time.""" start="00:17:14.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""So if you think about these statistics of course""" start="00:17:15.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""they only represent an average usage""" start="00:17:19.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""but sometimes it can get worse sometimes it can get better.""" start="00:17:23.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""The last parameter I'd like to talk about is""" start="00:17:26.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""garbage collection during Emacs init.""" start="00:17:33.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""Basically if you think about what happens during Emacs init""" start="00:17:35.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""like when Emacs just starting up""" start="00:17:40.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""then whatever garbage collection""" start="00:17:41.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""there it's one or it's several times""" start="00:17:44.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""it all contributes to Emacs taking longer to start.""" start="00:17:46.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""And again we can look into the statistic""" start="00:17:51.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""and see what is the total GC duration after Emacs init""" start="00:17:56.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""and we see that 50% of all the submissions""" start="00:18:01.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""garbage collection adds up more than one second""" start="00:18:06.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""to Emacs init time and for 20% of users""" start="00:18:10.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's extra three seconds Emacs start time""" start="00:18:14.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is very significant""" start="00:18:17.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""especially for people who are used to Vim""" start="00:18:18.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""which can start in like a fraction of a second""" start="00:18:21.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""and here it just does garbage collection""" start="00:18:23.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""because garbage collection is not""" start="00:18:26.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""everything Emacs does during startup""" start="00:18:27.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""adds up more to the load.""" start="00:18:29.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""Okay that's all nice and all""" start="00:18:32.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""but what can we do about these statistics""" start="00:18:36.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""can we draw any conclusions""" start="00:18:38.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""and the answer is of course""" start="00:18:40.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""like the most important conclusion here is that""" start="00:18:43.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""yes garbage collection can slow down Emacs""" start="00:18:46.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""at least for some people and what to do about it""" start="00:18:49.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""there are two variables which you can tweak""" start="00:18:52.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's because gcconce threshold gcconce percentage""" start="00:18:55.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""and having the statistics I can at least look a little bit""" start="00:18:58.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""into what is the effect of increasing these variables""" start="00:19:03.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""like most people just increase gcconce threshold""" start="00:19:08.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""and like all the submissions people did increase""" start="00:19:12.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""and doesn't make much sense to decrease it""" start="00:19:16.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""like to make things worse""" start="00:19:19.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""of course for these statistics""" start="00:19:21.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""the exact values of this increased thresholds""" start="00:19:27.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""are not always the same""" start="00:19:31.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""but at least we can look into some trends""" start="00:19:33.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""so first and obvious thing we can observe""" start="00:19:36.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""is when we compare""" start="00:19:44.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""the standard gc settings standard thresholds""" start="00:19:46.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""and increased thresholds for time between""" start="00:19:50.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""subsequent gcs and as one may expect""" start="00:19:54.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""if you increase the threshold""" start="00:19:57.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""Emacs will do garbage collection less frequently""" start="00:19:59.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""so the spacing between garbage collection increases""" start="00:20:02.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""okay the only thing is that""" start="00:20:05.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""if garbage collection is less frequent""" start="00:20:07.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""then each individual garbage collection becomes longer""" start="00:20:10.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""so if you think about increasing""" start="00:20:14.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""garbage collection thresholds be prepared""" start="00:20:18.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""that in each individual time Emacs freezes will take longer""" start="00:20:22.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""this is one caveat when we talk about""" start="00:20:26.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""this agglomerated gcs which are one after other""" start="00:20:31.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""like if you increase the threshold sufficiently""" start="00:20:34.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""then whatever happened that garbage collections""" start="00:20:36.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""were like done one after other""" start="00:20:42.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""we can now make it so that they are actually separated""" start="00:20:44.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""so like you don't see one giant freeze caused by""" start="00:20:47.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""like 10 gcs in a row""" start="00:20:51.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""instead you can make it so that they are separated""" start="00:20:52.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""and in statistics it's very clear""" start="00:20:55.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""that the number of agglomerated garbage collections""" start="00:20:59.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""decreases dramatically when you increase the thresholds""" start="00:21:02.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's particularly evident when we look into startup time""" start="00:21:06.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""if you look at gc duration during Emacs startup""" start="00:21:11.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""and if we look into what happens""" start="00:21:17.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""when you increase the thresholds""" start="00:21:19.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's very clear that Emacs startup become faster""" start="00:21:20.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""when you increase gc thresholds""" start="00:21:23.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""so that's all for actual user statistics""" start="00:21:26.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""and now let's try to run into""" start="00:21:33.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""some like actual recommendations""" start="00:21:35.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""on what numbers to set and before we start""" start="00:21:38.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""let me explain a little bit about""" start="00:21:42.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""the difference between these two variables""" start="00:21:44.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is gc constant threshold and gc constant percentage""" start="00:21:46.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""so if you think about Emacs memory""" start="00:21:48.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""like there's a certain memory allocated by Emacs""" start="00:21:52.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then as you run commands and turn using Emacs""" start="00:21:55.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""there is more memory allocated""" start="00:21:58.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""and Emacs decides when to do garbage collection""" start="00:22:00.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""according these two variables""" start="00:22:04.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""and actually what it does it chooses the larger one""" start="00:22:06.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""so say you have you are late in Emacs session""" start="00:22:08.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""you have a lot of Emacs memory allocated""" start="00:22:12.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""then you have gc constant percentage""" start="00:22:14.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is percent of the already allocated memory""" start="00:22:17.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""and that percent is probably going to be the largest""" start="00:22:19.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""because you have more memory""" start="00:22:25.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""and memory means that percent of it is larger""" start="00:22:28.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""so like you have a larger number cost""" start="00:22:32.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""by gc constant percentage""" start="00:22:36.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""so in this scenario when Emacs session is already running""" start="00:22:37.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""for a long time and there is a lot of memory allocated""" start="00:22:43.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""you have gc constant percentage""" start="00:22:45.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""controlling the garbage collection""" start="00:22:50.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""while early in Emacs there is not much memory placed""" start="00:22:52.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""Emacs just starting up then gc constant threshold""" start="00:22:55.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""is controlling how frequently garbage collection happens""" start="00:22:58.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""because smaller allocated memory""" start="00:23:01.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""means its percentage will be a small number""" start="00:23:04.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""so in terms of default values at least""" start="00:23:06.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""gc constant threshold is 800 kilobytes""" start="00:23:12.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""and gc constant percentage is 10""" start="00:23:14.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""so gc constant percentage becomes larger than that threshold""" start="00:23:18.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""when you have more than eight megabytes of allocated memory""" start="00:23:24.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""by Emacs which is quite early""" start="00:23:28.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""and it will probably hold just during the startup""" start="00:23:31.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""and once you start using your maximum""" start="00:23:34.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""and once you load all the histories""" start="00:23:36.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""all the kinds of buffers it's probably going to take""" start="00:23:38.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""more than much more than eight megabytes""" start="00:23:42.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""so now we understand this""" start="00:23:43.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""we can draw certain recommendations""" start="00:23:50.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""about tweaking the gc thresholds""" start="00:23:53.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""so first of all I need to emphasize""" start="00:23:57.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""that any time you increase gc threshold""" start="00:24:01.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""an individual garbage collection time increases""" start="00:24:03.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""so it's not free at all""" start="00:24:07.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""if you don't have problems with garbage collection""" start="00:24:08.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is half of the users don't have much problem""" start="00:24:11.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""you don't need to tweak anything""" start="00:24:13.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""only when gc is frequent and slow""" start="00:24:15.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""when Emacs is really really present frequently""" start="00:24:19.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""you may consider increasing gc thresholds only""" start="00:24:23.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""and in particular I recommend""" start="00:24:27.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""increasing gc constant percentage""" start="00:24:31.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""because that's what mostly controls gc""" start="00:24:33.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""when Emacs is running for long session""" start="00:24:36.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""and the numbers are probably like""" start="00:24:40.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""yeah we can estimate the effect of these numbers""" start="00:24:43.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""like for example if you have a default value of 0.1 percent""" start="00:24:46.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""for gc constant percentage 0.1 which is 10 percent""" start="00:24:49.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""and then increase it twice""" start="00:24:52.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""obviously you get twice less frequent gcs""" start="00:24:55.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""but it will come at the cost of extra 10 percent gc time""" start="00:24:58.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""and if you increase 10 times you can think about""" start="00:25:02.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""10 less 10 x less frequent gcs""" start="00:25:05.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""but almost twice longer individual garbage collection time""" start="00:25:08.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""so probably you want to set the number closer to 0.1""" start="00:25:12.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""another part of the users may actually""" start="00:25:16.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""try to optimize Emacs startup time""" start="00:25:23.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""which is quite frequent problem""" start="00:25:28.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""in this case it's probably better to increase gc constant""" start="00:25:30.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""but not too much so like""" start="00:25:34.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""first of all it makes sense to check""" start="00:25:38.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""whether garbage collection is a problem at all""" start="00:25:40.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""during startup and there are two variables""" start="00:25:43.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""which can show what is happening this garbage collection""" start="00:25:46.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""so gc done is a variable that shows""" start="00:25:50.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""how many garbage collection""" start="00:25:53.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""like what is the number of garbage collections triggered""" start="00:25:55.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""like when you check the value""" start="00:26:00.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""or right after you start Emacs""" start="00:26:02.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""you will see that""" start="00:26:04.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""number and gc elapsed variable""" start="00:26:04.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""which gives you a number of seconds""" start="00:26:08.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""which Emacs spent in doing garbage collection""" start="00:26:11.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""so this is probably the most important variable""" start="00:26:14.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""and if you see it's large then you may consider tweaking it""" start="00:26:16.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""for the Emacs startup we can estimate some bounds""" start="00:26:20.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""because in the statistics I never saw anything""" start="00:26:26.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""that is more than 10 seconds extra""" start="00:26:30.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""which even 10 seconds is probably like""" start="00:26:32.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""a really really hard upper bound so""" start="00:26:34.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""or say if you want to decrease the gc contribution""" start="00:26:39.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""like order of magnitude or like two orders of magnitudes""" start="00:26:44.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""let's say like as a really hard top estimate""" start="00:26:47.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""then it corresponds to 80 megabytes gc constant""" start="00:26:50.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""and probably much less so like""" start="00:26:55.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""there's no point setting it""" start="00:26:58.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""to a few hundred megabytes of course""" start="00:27:00.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""there's one caveat which is important to keep in""" start="00:27:04.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""mind though that increasing the gc thresholds""" start="00:27:08.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""is not just increasing individual gc time""" start="00:27:14.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""there's also an actual real impact on the RAM usage""" start="00:27:16.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""so like if you increase gc threshold""" start="00:27:20.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""it increases the RAM usage of Emacs""" start="00:27:23.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you shouldn't think that like okay""" start="00:27:26.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""I increased the threshold by like 100 megabytes""" start="00:27:29.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""then 100 megabytes extra RAM usage doesn't matter""" start="00:27:33.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's not 100 megabytes""" start="00:27:37.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""because less frequent garbage collection means""" start="00:27:38.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""it will lead to memory fragmentation""" start="00:27:42.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""so in practice if you increase the thresholds""" start="00:27:45.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""to tens or hundreds of megabytes""" start="00:27:50.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""we are talking about gigabytes extra RAM usage""" start="00:27:52.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""for me personally when I tried to play with gc thresholds""" start="00:27:55.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""I have seen Emacs taking two gigabytes like""" start="00:27:59.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""compared to several times less""" start="00:28:02.880" video="mainVideo-gc" id="subtitle"]] [[!template text="""when with default settings so it's not free at all""" start="00:28:05.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""and only like either when you have a lot of free RAM""" start="00:28:09.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you don't care or when your Emacs is really slow""" start="00:28:13.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""then you may need to consider this""" start="00:28:16.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""tweaking these defaults so again don't tweak defaults""" start="00:28:19.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""if you don't really have a problem""" start="00:28:23.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""and of course this RAM problem is a big big deal""" start="00:28:24.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""for Emacs devs because from from the point of single user""" start="00:28:29.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""you have like normal laptop most likely like normal PC""" start="00:28:35.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""with a lot of RAM you don't care about these things too much""" start="00:28:38.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""but Emacs in general can run on like all kinds of machines""" start="00:28:42.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""including low-end machines with very limited RAM""" start="00:28:49.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""and anytime Emacs developers consider increasing""" start="00:28:51.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""the defaults for garbage collection""" start="00:28:55.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's like they always have to consider""" start="00:28:57.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""if you increase them too much""" start="00:29:01.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""then Emacs may just stop running on certain platforms""" start="00:29:02.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""so that's a very big consideration in terms""" start="00:29:07.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""of the global defaults for everyone""" start="00:29:14.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""although I have to I would say that it might be related""" start="00:29:16.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""to the safe to increase GCCons threshold""" start="00:29:22.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""because it mostly affects startup and during startup""" start="00:29:24.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's probably not the peak usage of Emacs""" start="00:29:27.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""and like as Emacs runs for longer""" start="00:29:31.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""it's probably where most of RAM will be used later""" start="00:29:35.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""on the other hand GCCons percentage is much more debating""" start="00:29:38.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""because it has pros and cons""" start="00:29:44.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""it will increase the RAM usage""" start="00:29:46.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""it will increase the individual GC time so""" start="00:29:47.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""if we consider changing it it's much more tricky""" start="00:29:51.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""and we have discussing probably measure the impact on users""" start="00:29:56.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""and a final note on or from the point of view""" start="00:29:59.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""of Emacs development is""" start="00:30:05.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""that this simple mark-and-sweep algorithm""" start="00:30:07.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""is like a very old and not the state-of-the-art algorithm""" start="00:30:11.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""there are variants of garbage collection""" start="00:30:14.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""that are like totally non-blocking""" start="00:30:17.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""so Emacs just doesn't have to freeze""" start="00:30:19.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""during the garbage collection""" start="00:30:22.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""or there are variants of garbage collection algorithm""" start="00:30:24.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""that do not scan all the memory just fraction of it""" start="00:30:26.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""and scan another fraction less frequently""" start="00:30:30.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""so there are actually ways just to change""" start="00:30:33.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""the garbage collection algorithm to make things much faster""" start="00:30:37.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""of course like just changing the numbers of variables""" start="00:30:39.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""like the numbers of variable values""" start="00:30:44.200" video="mainVideo-gc" id="subtitle"]] [[!template text="""is much more tricky and one has to implement it""" start="00:30:47.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""obviously it would be nice if someone implements it""" start="00:30:50.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""but so far it's not happening so yeah it would be nice""" start="00:30:52.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""but maybe not not so quickly""" start="00:30:55.640" video="mainVideo-gc" id="subtitle"]] [[!template text="""there is more chance to change the defaults here""" start="00:30:59.360" video="mainVideo-gc" id="subtitle"]] [[!template text="""to conclude let me reiterate the most important points""" start="00:31:02.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""so from point of view of users you need to understand that""" start="00:31:07.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""yes garbage collection may be a problem""" start="00:31:11.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""but not for everyone so like""" start="00:31:14.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""you should only think about changing the variables""" start="00:31:16.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""when you really know that garbage collection""" start="00:31:21.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""is the problem for you so if you have slow Emacs startup""" start="00:31:23.560" video="mainVideo-gc" id="subtitle"]] [[!template text="""slow Emacs startup and you know that it's caused by""" start="00:31:27.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""garbage collection like by""" start="00:31:30.920" video="mainVideo-gc" id="subtitle"]] [[!template text="""you can check the GC elapsed variable""" start="00:31:32.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""then you may increase GC count threshold""" start="00:31:36.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""like to few tens of megabytes not more""" start="00:31:39.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""it doesn't make sense to increase it much more""" start="00:31:42.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""and if you really have major problems""" start="00:31:44.480" video="mainVideo-gc" id="subtitle"]] [[!template text="""with Emacs being slaggy""" start="00:31:48.240" video="mainVideo-gc" id="subtitle"]] [[!template text="""then you can increase GC count percentage""" start="00:31:49.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""to like 0.2 0.3 maybe""" start="00:31:52.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""one is probably overkill""" start="00:31:56.000" video="mainVideo-gc" id="subtitle"]] [[!template text="""but do watch your Emacs ROM usage it may be really impacted""" start="00:31:57.680" video="mainVideo-gc" id="subtitle"]] [[!template text="""for Emacs developers I'd like to emphasize""" start="00:32:02.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""that there is a real problem with garbage collection""" start="00:32:09.720" video="mainVideo-gc" id="subtitle"]] [[!template text="""and nine percent of all the garbage collection""" start="00:32:12.440" video="mainVideo-gc" id="subtitle"]] [[!template text="""data points we have correspond""" start="00:32:17.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""to really slow noticeable Emacs precision""" start="00:32:22.080" video="mainVideo-gc" id="subtitle"]] [[!template text="""and really frequent less than 10 seconds""" start="00:32:24.960" video="mainVideo-gc" id="subtitle"]] [[!template text="""I'd say that it's really worth""" start="00:32:28.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""increasing GC count threshold at least during startup""" start="00:32:32.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""because it really impacts the Emacs startup time""" start="00:32:35.280" video="mainVideo-gc" id="subtitle"]] [[!template text="""making Emacs startup much faster""" start="00:32:40.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""ideally we need to reimplement""" start="00:32:41.520" video="mainVideo-gc" id="subtitle"]] [[!template text="""the garbage collection algorithm of course it's not easy""" start="00:32:44.800" video="mainVideo-gc" id="subtitle"]] [[!template text="""but it would be really nice""" start="00:32:48.600" video="mainVideo-gc" id="subtitle"]] [[!template text="""and for GC count percentage defaults it's hard to say""" start="00:32:50.160" video="mainVideo-gc" id="subtitle"]] [[!template text="""we may consider changing it but it's up to discussion""" start="00:32:56.400" video="mainVideo-gc" id="subtitle"]] [[!template text="""and we probably need to be conservative here""" start="00:33:00.760" video="mainVideo-gc" id="subtitle"]] [[!template text="""so we came to the end of my talk""" start="00:33:03.120" video="mainVideo-gc" id="subtitle"]] [[!template text="""and this presentation""" start="00:33:06.040" video="mainVideo-gc" id="subtitle"]] [[!template text="""all the data will be available publicly""" start="00:33:09.320" video="mainVideo-gc" id="subtitle"]] [[!template text="""and you can reproduce all the statistic graphs if you wish""" start="00:33:11.840" video="mainVideo-gc" id="subtitle"]] [[!template text="""and thank you for attention""" start="00:33:17.080" video="mainVideo-gc" id="subtitle"]] <a name="gc-qanda-transcript"></a> # Q&A transcript (unedited) [[!template text="""[Speaker 0]: And then, hi everyone.""" start="00:00:01.620" video="qanda-gc" id="subtitle"]] [[!template text="""Thank you for your nice talk,""" start="00:00:03.760" video="qanda-gc" id="subtitle"]] [[!template text="""I can say it's the Emacs GC.""" start="00:00:05.900" video="qanda-gc" id="subtitle"]] [[!template text="""We have some questions on the pad and maybe""" start="00:00:09.280" video="qanda-gc" id="subtitle"]] [[!template text="""before I would like to ask you something to""" start="00:00:11.580" video="qanda-gc" id="subtitle"]] [[!template text="""the last 1 you have said,""" start="00:00:12.780" video="qanda-gc" id="subtitle"]] [[!template text="""concerning changing the GC strategy,""" start="00:00:15.200" video="qanda-gc" id="subtitle"]] [[!template text="""that it's unlikely that it will be happening""" start="00:00:18.500" video="qanda-gc" id="subtitle"]] [[!template text="""in the next time. Yeah.""" start="00:00:20.380" video="qanda-gc" id="subtitle"]] [[!template text="""Is there any discussion going on or why does""" start="00:00:22.760" video="qanda-gc" id="subtitle"]] [[!template text="""the case it's not changing the strategy?""" start="00:00:24.320" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: It's mostly because it's difficult.""" start="00:00:26.640" video="qanda-gc" id="subtitle"]] [[!template text="""I think, yesterday you heard from,""" start="00:00:29.439" video="qanda-gc" id="subtitle"]] [[!template text="""1 of the dev talks that like there was 1""" start="00:00:33.400" video="qanda-gc" id="subtitle"]] [[!template text="""small, short comment that,""" start="00:00:34.980" video="qanda-gc" id="subtitle"]] [[!template text="""oh yeah, it would be nice to change this""" start="00:00:36.780" video="qanda-gc" id="subtitle"]] [[!template text="""algorithm but it's hard.""" start="00:00:39.059" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: So I""" start="00:00:40.760" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: mean it's hard not because the algorithm is""" start="00:00:43.260" video="qanda-gc" id="subtitle"]] [[!template text="""that hard but because it's a very low level""" start="00:00:45.400" video="qanda-gc" id="subtitle"]] [[!template text="""code and it must be like very carefully""" start="00:00:48.000" video="qanda-gc" id="subtitle"]] [[!template text="""weighted. So that can be,""" start="00:00:49.960" video="qanda-gc" id="subtitle"]] [[!template text="""it needs to be made sure that the carousel""" start="00:00:53.239" video="qanda-gc" id="subtitle"]] [[!template text="""will work. It's all bugs.""" start="00:00:55.280" video="qanda-gc" id="subtitle"]] [[!template text="""If you have bugs and you can see that,""" start="00:00:57.440" video="qanda-gc" id="subtitle"]] [[!template text="""so it's nothing to work anymore.""" start="00:00:58.660" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: So We have a lot of RAM usage.""" start="00:01:00.720" video="qanda-gc" id="subtitle"]] [[!template text="""Yeah. Maybe sometime.""" start="00:01:02.240" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: There was like years ago,""" start="00:01:06.180" video="qanda-gc" id="subtitle"]] [[!template text="""there was a branch on generational DC,""" start="00:01:09.640" video="qanda-gc" id="subtitle"]] [[!template text="""if I remember correctly,""" start="00:01:11.100" video="qanda-gc" id="subtitle"]] [[!template text="""but they didn't go anywhere,""" start="00:01:13.380" video="qanda-gc" id="subtitle"]] [[!template text="""unfortunately.""" start="00:01:14.760" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: That's a pity. But let's come to the""" start="00:01:18.900" video="qanda-gc" id="subtitle"]] [[!template text="""questions on the pad. So the first 1 is,""" start="00:01:21.500" video="qanda-gc" id="subtitle"]] [[!template text="""are the GC duration statistics correlated""" start="00:01:24.340" video="qanda-gc" id="subtitle"]] [[!template text="""with users? I mean, does the same user""" start="00:01:27.340" video="qanda-gc" id="subtitle"]] [[!template text="""experience GC of various durations?""" start="00:01:29.440" video="qanda-gc" id="subtitle"]] [[!template text="""Or Do some users experience GC of a greater""" start="00:01:32.900" video="qanda-gc" id="subtitle"]] [[!template text="""0.26 exclusively, while others never""" start="00:01:36.680" video="qanda-gc" id="subtitle"]] [[!template text="""experience them? So is it correlated to user""" start="00:01:40.440" video="qanda-gc" id="subtitle"]] [[!template text="""behavior? I guess you said it in your talk.""" start="00:01:43.780" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: Well, If you talk formally,""" start="00:01:46.160" video="qanda-gc" id="subtitle"]] [[!template text="""then almost every user has like 1 or 2""" start="00:01:49.340" video="qanda-gc" id="subtitle"]] [[!template text="""occasions when GC takes more than 0.2""" start="00:01:51.500" video="qanda-gc" id="subtitle"]] [[!template text="""seconds, but it's like,""" start="00:01:53.040" video="qanda-gc" id="subtitle"]] [[!template text="""maybe something else is using CPU and that's""" start="00:01:56.720" video="qanda-gc" id="subtitle"]] [[!template text="""why, but in practice, there are users who""" start="00:02:00.720" video="qanda-gc" id="subtitle"]] [[!template text="""don't have problem. Half of them that that's""" start="00:02:04.200" video="qanda-gc" id="subtitle"]] [[!template text="""who that's what I looked from statistics.""" start="00:02:05.800" video="qanda-gc" id="subtitle"]] [[!template text="""And dry users who have like really big""" start="00:02:10.240" video="qanda-gc" id="subtitle"]] [[!template text="""problems, like 1 second GC time.""" start="00:02:12.520" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: This is dependent on you make some comments""" start="00:02:17.280" video="qanda-gc" id="subtitle"]] [[!template text="""on us in the talk, but could you like extract""" start="00:02:19.960" video="qanda-gc" id="subtitle"]] [[!template text="""on if it's a package, that's a problem or we""" start="00:02:23.000" video="qanda-gc" id="subtitle"]] [[!template text="""as a user behavior are there.""" start="00:02:24.780" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: Usually it's something that is,""" start="00:02:30.720" video="qanda-gc" id="subtitle"]] [[!template text="""okay. I'm sharing my screen now,""" start="00:02:33.760" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: It's coming on, give it like 2 to 3 seconds.""" start="00:02:37.580" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: right? Yeah. So I can just click through""" start="00:02:41.480" video="qanda-gc" id="subtitle"]] [[!template text="""different user statistics.""" start="00:02:42.940" video="qanda-gc" id="subtitle"]] [[!template text="""So like you can see this duration for each""" start="00:02:48.840" video="qanda-gc" id="subtitle"]] [[!template text="""individual user basically.""" start="00:02:49.960" video="qanda-gc" id="subtitle"]] [[!template text="""So you can see like here for example it's""" start="00:02:54.240" video="qanda-gc" id="subtitle"]] [[!template text="""like averages around 0.25""" start="00:02:56.320" video="qanda-gc" id="subtitle"]] [[!template text="""seconds which is noticeable and here is like""" start="00:03:00.040" video="qanda-gc" id="subtitle"]] [[!template text="""0.1 like someone is all over the place,""" start="00:03:03.640" video="qanda-gc" id="subtitle"]] [[!template text="""probably some. Then like,""" start="00:03:09.560" video="qanda-gc" id="subtitle"]] [[!template text="""what else can we see here?""" start="00:03:11.520" video="qanda-gc" id="subtitle"]] [[!template text="""Yeah, some users like have sub 0.1,""" start="00:03:15.140" video="qanda-gc" id="subtitle"]] [[!template text="""no problem at all. And I have seen some that""" start="00:03:23.320" video="qanda-gc" id="subtitle"]] [[!template text="""really, really bad. I mean,""" start="00:03:30.180" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: if it's noticeable, it's all bad.""" start="00:03:31.880" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: So yeah. For example, here it's like 0.8""" start="00:03:36.960" video="qanda-gc" id="subtitle"]] [[!template text="""seconds, 0.5 seconds. I don't know how that""" start="00:03:41.680" video="qanda-gc" id="subtitle"]] [[!template text="""guy uses ZMax. Yeah. you can see it varies.""" start="00:03:48.600" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: So It varies quite a lot.""" start="00:03:51.160" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: What it depends on, like,""" start="00:03:52.760" video="qanda-gc" id="subtitle"]] [[!template text="""usually the number of packages,""" start="00:03:54.120" video="qanda-gc" id="subtitle"]] [[!template text="""like all kinds of timers going on under the""" start="00:03:58.440" video="qanda-gc" id="subtitle"]] [[!template text="""hood. I think I tried to list...""" start="00:04:01.720" video="qanda-gc" id="subtitle"]] [[!template text="""I'll go through this. I briefly outlined some""" start="00:04:12.520" video="qanda-gc" id="subtitle"]] [[!template text="""important parts. Here,""" start="00:04:15.440" video="qanda-gc" id="subtitle"]] [[!template text="""when you have something like an org agenda,""" start="00:04:18.480" video="qanda-gc" id="subtitle"]] [[!template text="""it will most likely trigger a lot of GCs.""" start="00:04:20.680" video="qanda-gc" id="subtitle"]] [[!template text="""When you have a lot of timers,""" start="00:04:23.900" video="qanda-gc" id="subtitle"]] [[!template text="""when you have something calculated on""" start="00:04:27.800" video="qanda-gc" id="subtitle"]] [[!template text="""modline, it will be frequently triggered.""" start="00:04:29.700" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Well,""" start="00:04:30.900" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: yeah. When you have so many packages and""" start="00:04:34.080" video="qanda-gc" id="subtitle"]] [[!template text="""these packages are using a lot of memory.""" start="00:04:35.760" video="qanda-gc" id="subtitle"]] [[!template text="""Like I remember I was surprised by this,""" start="00:04:41.120" video="qanda-gc" id="subtitle"]] [[!template text="""package, home org that was,""" start="00:04:44.640" video="qanda-gc" id="subtitle"]] [[!template text="""caching all the results.""" start="00:04:46.560" video="qanda-gc" id="subtitle"]] [[!template text="""And for large org files,""" start="00:04:48.960" video="qanda-gc" id="subtitle"]] [[!template text="""it was like several hundred megabytes of""" start="00:04:51.540" video="qanda-gc" id="subtitle"]] [[!template text="""data. Well, it just becomes slower.""" start="00:04:55.160" video="qanda-gc" id="subtitle"]] [[!template text="""Yeah.""" start="00:04:55.900" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Yeah. Maybe, maybe a short side note.""" start="00:05:00.020" video="qanda-gc" id="subtitle"]] [[!template text="""Someone asks, what software you're using for""" start="00:05:02.600" video="qanda-gc" id="subtitle"]] [[!template text="""flipping through the PNGs.""" start="00:05:03.480" video="qanda-gc" id="subtitle"]] [[!template text="""Maybe you could shortly throws it in.""" start="00:05:06.660" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: What do you mean? Here,""" start="00:05:08.800" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: I guess it was just simply,""" start="00:05:11.000" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: this, It's it's far. Yeah.""" start="00:05:13.480" video="qanda-gc" id="subtitle"]] [[!template text="""So""" start="00:05:16.660" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: yeah. So, question 1 and 2 answered.""" start="00:05:23.900" video="qanda-gc" id="subtitle"]] [[!template text="""To 1 statement you have made,""" start="00:05:35.740" video="qanda-gc" id="subtitle"]] [[!template text="""there was a question concerning the timings.""" start="00:05:37.500" video="qanda-gc" id="subtitle"]] [[!template text="""So you said, okay, everything above 0.1""" start="00:05:41.180" video="qanda-gc" id="subtitle"]] [[!template text="""second is fine. Maybe There's a short story""" start="00:05:45.800" video="qanda-gc" id="subtitle"]] [[!template text="""of someone who asked a question.""" start="00:05:48.480" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: I see the question is about scrolling,""" start="00:05:50.380" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Yeah, exactly.""" start="00:05:51.820" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: right? Again, there's not much you can do in""" start="00:05:55.580" video="qanda-gc" id="subtitle"]] [[!template text="""terms of trying to adjust the GC time.""" start="00:05:58.620" video="qanda-gc" id="subtitle"]] [[!template text="""I mean, if you make GCs less frequent,""" start="00:06:02.320" video="qanda-gc" id="subtitle"]] [[!template text="""you increase the individual GC time.""" start="00:06:07.540" video="qanda-gc" id="subtitle"]] [[!template text="""If you make them more frequent,""" start="00:06:08.860" video="qanda-gc" id="subtitle"]] [[!template text="""you decrease the individual GC time,""" start="00:06:11.280" video="qanda-gc" id="subtitle"]] [[!template text="""but then they are more frequent.""" start="00:06:12.400" video="qanda-gc" id="subtitle"]] [[!template text="""So what is the point? I think the way to go""" start="00:06:15.920" video="qanda-gc" id="subtitle"]] [[!template text="""here is you can rise to see the short for the""" start="00:06:19.940" video="qanda-gc" id="subtitle"]] [[!template text="""duration of scrolling,""" start="00:06:20.740" video="qanda-gc" id="subtitle"]] [[!template text="""like just for a comment.""" start="00:06:22.500" video="qanda-gc" id="subtitle"]] [[!template text="""I think it's a recommendation from Emacs""" start="00:06:26.320" video="qanda-gc" id="subtitle"]] [[!template text="""devs. So like You do something along the""" start="00:06:31.480" video="qanda-gc" id="subtitle"]] [[!template text="""lines.""" start="00:06:31.660" video="qanda-gc" id="subtitle"]] [[!template text="""Yeah, I'm surely doing something on my screen""" start="00:06:53.480" video="qanda-gc" id="subtitle"]] [[!template text="""and I forgot that I'm not sharing anything.""" start="00:06:55.680" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Exactly.""" start="00:06:56.680" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: Simply something like this.""" start="00:07:00.700" video="qanda-gc" id="subtitle"]] [[!template text="""So, basically, if you have some command that""" start="00:07:08.140" video="qanda-gc" id="subtitle"]] [[!template text="""is very important that it should run very""" start="00:07:10.920" video="qanda-gc" id="subtitle"]] [[!template text="""quickly. You temporary increase that""" start="00:07:13.860" video="qanda-gc" id="subtitle"]] [[!template text="""threshold, you run that comment,""" start="00:07:15.740" video="qanda-gc" id="subtitle"]] [[!template text="""then that's all. That's probably the best.""" start="00:07:19.940" video="qanda-gc" id="subtitle"]] [[!template text="""So basically, the best you can do is to delay""" start="00:07:21.660" video="qanda-gc" id="subtitle"]] [[!template text="""it after the command.""" start="00:07:23.760" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: So afterwards, it takes a lot of time to do""" start="00:07:27.500" video="qanda-gc" id="subtitle"]] [[!template text="""its stuff. OK. The third 1 has been already""" start="00:07:36.140" video="qanda-gc" id="subtitle"]] [[!template text="""answered, but I just want to get your""" start="00:07:40.520" video="qanda-gc" id="subtitle"]] [[!template text="""information from it. Opinions on the GCMH""" start="00:07:42.780" video="qanda-gc" id="subtitle"]] [[!template text="""mode.""" start="00:07:43.940" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: Okay. Yeah, I see that problem,""" start="00:07:48.280" video="qanda-gc" id="subtitle"]] [[!template text="""but that's more like a technical problem.""" start="00:07:49.920" video="qanda-gc" id="subtitle"]] [[!template text="""But there's another problem there.""" start="00:07:52.360" video="qanda-gc" id="subtitle"]] [[!template text="""Yeah, I prepared a small snippet here.""" start="00:07:57.340" video="qanda-gc" id="subtitle"]] [[!template text="""So if you look at the GCMH mode,""" start="00:08:02.160" video="qanda-gc" id="subtitle"]] [[!template text="""it has this concept of low threshold and high""" start="00:08:05.800" video="qanda-gc" id="subtitle"]] [[!template text="""threshold and most of the time it's running""" start="00:08:08.200" video="qanda-gc" id="subtitle"]] [[!template text="""high threshold and then when Emacs is idle,""" start="00:08:14.120" video="qanda-gc" id="subtitle"]] [[!template text="""it falls back to lower threshold and then it""" start="00:08:17.320" video="qanda-gc" id="subtitle"]] [[!template text="""does the GC while Emacs is not used.""" start="00:08:19.400" video="qanda-gc" id="subtitle"]] [[!template text="""That's a good idea, of course.""" start="00:08:22.040" video="qanda-gc" id="subtitle"]] [[!template text="""That's the core idea of GCMH mode.""" start="00:08:24.380" video="qanda-gc" id="subtitle"]] [[!template text="""Unfortunately, the most annoying GC is when""" start="00:08:30.520" video="qanda-gc" id="subtitle"]] [[!template text="""you're actively using max.""" start="00:08:31.760" video="qanda-gc" id="subtitle"]] [[!template text="""And then you have this huge value of GC""" start="00:08:37.120" video="qanda-gc" id="subtitle"]] [[!template text="""counter show and look at the doc stream.""" start="00:08:38.799" video="qanda-gc" id="subtitle"]] [[!template text="""This would be sector value that makes GC""" start="00:08:41.760" video="qanda-gc" id="subtitle"]] [[!template text="""unlikely but does not cost OSP Asian.""" start="00:08:43.980" video="qanda-gc" id="subtitle"]] [[!template text="""So yeah, no wonder like if you don't do GC,""" start="00:08:46.480" video="qanda-gc" id="subtitle"]] [[!template text="""your arm usage will skyrocket.""" start="00:08:49.640" video="qanda-gc" id="subtitle"]] [[!template text="""So they don't, they cannot put it too much,""" start="00:08:54.360" video="qanda-gc" id="subtitle"]] [[!template text="""but this is like already like,""" start="00:08:57.720" video="qanda-gc" id="subtitle"]] [[!template text="""how much was it?""" start="00:08:59.220" video="qanda-gc" id="subtitle"]] [[!template text="""1 gigabyte, that's the default.""" start="00:09:10.800" video="qanda-gc" id="subtitle"]] [[!template text="""And the problem is when you have 1 gigabyte""" start="00:09:15.220" video="qanda-gc" id="subtitle"]] [[!template text="""to garbage collect, it causes really long GC""" start="00:09:18.680" video="qanda-gc" id="subtitle"]] [[!template text="""time. So in GC image mode,""" start="00:09:22.040" video="qanda-gc" id="subtitle"]] [[!template text="""when you're actually using Emacs,""" start="00:09:23.560" video="qanda-gc" id="subtitle"]] [[!template text="""really heavily, the GCs become terrible,""" start="00:09:28.860" video="qanda-gc" id="subtitle"]] [[!template text="""terribly slow. So it may help in case you""" start="00:09:34.640" video="qanda-gc" id="subtitle"]] [[!template text="""don't have too much problems with GC,""" start="00:09:37.200" video="qanda-gc" id="subtitle"]] [[!template text="""but I will say that in such situation,""" start="00:09:39.280" video="qanda-gc" id="subtitle"]] [[!template text="""you can simply increase GC cost percentage,""" start="00:09:41.920" video="qanda-gc" id="subtitle"]] [[!template text="""as I recommend, and it should do it.""" start="00:09:44.540" video="qanda-gc" id="subtitle"]] [[!template text="""But in case of really big problems with""" start="00:09:48.480" video="qanda-gc" id="subtitle"]] [[!template text="""garbage collection, no,""" start="00:09:50.080" video="qanda-gc" id="subtitle"]] [[!template text="""I don't think that will help much.""" start="00:09:51.740" video="qanda-gc" id="subtitle"]] [[!template text="""I used it myself and it didn't help much for""" start="00:09:54.800" video="qanda-gc" id="subtitle"]] [[!template text="""my stuff.""" start="00:09:55.200" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: All right. The next question is concerning""" start="00:09:59.680" video="qanda-gc" id="subtitle"]] [[!template text="""freeing up memory. Is there some way to free""" start="00:10:04.600" video="qanda-gc" id="subtitle"]] [[!template text="""up memory such as via unload feature on""" start="00:10:07.200" video="qanda-gc" id="subtitle"]] [[!template text="""Emacs? Often I only need a package loaded for""" start="00:10:09.960" video="qanda-gc" id="subtitle"]] [[!template text="""a single task or short period by the""" start="00:10:12.240" video="qanda-gc" id="subtitle"]] [[!template text="""persistent memory afterwards.""" start="00:10:13.320" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: So the packages are usually not that much of""" start="00:10:19.780" video="qanda-gc" id="subtitle"]] [[!template text="""a problem. I mean, the libraries,""" start="00:10:22.060" video="qanda-gc" id="subtitle"]] [[!template text="""the problem is some extra,""" start="00:10:25.280" video="qanda-gc" id="subtitle"]] [[!template text="""like some variable contents or some""" start="00:10:30.060" video="qanda-gc" id="subtitle"]] [[!template text="""histories, some caches.""" start="00:10:31.800" video="qanda-gc" id="subtitle"]] [[!template text="""That's what's eating most of the memory.""" start="00:10:35.280" video="qanda-gc" id="subtitle"]] [[!template text="""There is a package called memory usage and""" start="00:10:40.240" video="qanda-gc" id="subtitle"]] [[!template text="""built in MX memory report.""" start="00:10:45.440" video="qanda-gc" id="subtitle"]] [[!template text="""They allow to see which variables take a lot""" start="00:10:50.900" video="qanda-gc" id="subtitle"]] [[!template text="""of memory. And that way you can try to see""" start="00:10:56.000" video="qanda-gc" id="subtitle"]] [[!template text="""which packages are actually problematic.""" start="00:10:58.520" video="qanda-gc" id="subtitle"]] [[!template text="""So for example, I recall,""" start="00:11:03.340" video="qanda-gc" id="subtitle"]] [[!template text="""and that was not exactly,""" start="00:11:05.640" video="qanda-gc" id="subtitle"]] [[!template text="""I remember there was a package that was""" start="00:11:09.720" video="qanda-gc" id="subtitle"]] [[!template text="""literally in command line,""" start="00:11:11.040" video="qanda-gc" id="subtitle"]] [[!template text="""like prompt history. I think it was in""" start="00:11:14.020" video="qanda-gc" id="subtitle"]] [[!template text="""command. And when you do like,""" start="00:11:17.540" video="qanda-gc" id="subtitle"]] [[!template text="""when you save every message in your chart""" start="00:11:20.440" video="qanda-gc" id="subtitle"]] [[!template text="""into prompt history, that can grow very fast""" start="00:11:25.280" video="qanda-gc" id="subtitle"]] [[!template text="""and can go to several hundred megabytes just""" start="00:11:29.220" video="qanda-gc" id="subtitle"]] [[!template text="""in that history. And that can cause major""" start="00:11:31.720" video="qanda-gc" id="subtitle"]] [[!template text="""problems. So, yes, profiling the largest""" start="00:11:37.960" video="qanda-gc" id="subtitle"]] [[!template text="""variables with the largest buffers that might""" start="00:11:41.200" video="qanda-gc" id="subtitle"]] [[!template text="""give some clues. Again,""" start="00:11:42.660" video="qanda-gc" id="subtitle"]] [[!template text="""there is no silver bullet.""" start="00:11:43.740" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Right. I think the last question on the""" start="00:11:49.080" video="qanda-gc" id="subtitle"]] [[!template text="""patterns. At first, very nice presentation.""" start="00:11:51.000" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: I can""" start="00:11:51.620" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: also only agree with that.""" start="00:11:53.980" video="qanda-gc" id="subtitle"]] [[!template text="""I just experienced with a threshold and""" start="00:11:56.480" video="qanda-gc" id="subtitle"]] [[!template text="""lowered my GCE lapse from 1.1""" start="00:11:58.200" video="qanda-gc" id="subtitle"]] [[!template text="""to 0.06 seconds during startup.""" start="00:12:01.440" video="qanda-gc" id="subtitle"]] [[!template text="""Interestingly, going to 10 megabytes""" start="00:12:03.600" video="qanda-gc" id="subtitle"]] [[!template text="""increased the time. 4 megabytes was a sweet""" start="00:12:06.100" video="qanda-gc" id="subtitle"]] [[!template text="""spot for my system. What is the recommended""" start="00:12:07.800" video="qanda-gc" id="subtitle"]] [[!template text="""way to lower the value back to the default""" start="00:12:10.840" video="qanda-gc" id="subtitle"]] [[!template text="""value after startup is completed?""" start="00:12:12.340" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: I think you just use after init hook.""" start="00:12:16.160" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: This was a relatively fast answer.""" start="00:12:23.940" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: So basically for example Doom does this,""" start="00:12:29.180" video="qanda-gc" id="subtitle"]] [[!template text="""it temporary writes a gcconcert hold during""" start="00:12:31.940" video="qanda-gc" id="subtitle"]] [[!template text="""startup and yeah after init hook the code is""" start="00:12:37.260" video="qanda-gc" id="subtitle"]] [[!template text="""like it's 1 of the commonly suggested""" start="00:12:39.880" video="qanda-gc" id="subtitle"]] [[!template text="""approaches and is I believe it's the right 1.""" start="00:12:43.940" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Right. To have joined us 1 was a microphone.""" start="00:12:49.180" video="qanda-gc" id="subtitle"]] [[!template text="""So Peter, do you have any questions that you""" start="00:12:52.200" video="qanda-gc" id="subtitle"]] [[!template text="""want to question? And maybe as a side note,""" start="00:12:55.240" video="qanda-gc" id="subtitle"]] [[!template text="""we only have 4 minutes left and afterwards""" start="00:12:57.380" video="qanda-gc" id="subtitle"]] [[!template text="""this happy weekend will still be open,""" start="00:12:59.240" video="qanda-gc" id="subtitle"]] [[!template text="""but we will switch back to the talks.""" start="00:13:01.400" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 2]: Yeah, no more questions on garbage""" start="00:13:05.380" video="qanda-gc" id="subtitle"]] [[!template text="""collection, but I just wanted to thank Ihor""" start="00:13:07.640" video="qanda-gc" id="subtitle"]] [[!template text="""for his engagement in the community.""" start="00:13:10.440" video="qanda-gc" id="subtitle"]] [[!template text="""And especially with, I'm a co-maintainer on""" start="00:13:15.300" video="qanda-gc" id="subtitle"]] [[!template text="""orgnotor and he's helped us a lot with""" start="00:13:17.600" video="qanda-gc" id="subtitle"]] [[!template text="""getting us up to date with newer versions of""" start="00:13:21.680" video="qanda-gc" id="subtitle"]] [[!template text="""org and stuff like that.""" start="00:13:22.680" video="qanda-gc" id="subtitle"]] [[!template text="""So just wanted to thank you in person.""" start="00:13:24.680" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: Right.""" start="00:13:25.140" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Maybe 1 question for me,""" start="00:13:33.540" video="qanda-gc" id="subtitle"]] [[!template text="""you had some bit talked about memory""" start="00:13:35.460" video="qanda-gc" id="subtitle"]] [[!template text="""fragmentation. So is there any way to or is""" start="00:13:40.640" video="qanda-gc" id="subtitle"]] [[!template text="""it fixed by Emacs itself?""" start="00:13:42.080" video="qanda-gc" id="subtitle"]] [[!template text="""So you have like""" start="00:13:43.740" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: a chunk of memory fragmentation is basically""" start="00:13:46.520" video="qanda-gc" id="subtitle"]] [[!template text="""your OS. Yeah, Emacs releases the memory and""" start="00:13:51.420" video="qanda-gc" id="subtitle"]] [[!template text="""then OS can rearrange it depending on the""" start="00:13:55.020" video="qanda-gc" id="subtitle"]] [[!template text="""implementation of its memory manager.""" start="00:13:58.320" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Okay, so the GC just releases it really and""" start="00:14:01.520" video="qanda-gc" id="subtitle"]] [[!template text="""not so it could be that a mix is like""" start="00:14:04.400" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: doing it. You have like memory pages,""" start="00:14:07.420" video="qanda-gc" id="subtitle"]] [[!template text="""right? Yeah. And you see,""" start="00:14:09.560" video="qanda-gc" id="subtitle"]] [[!template text="""can release a part of this page just like""" start="00:14:12.140" video="qanda-gc" id="subtitle"]] [[!template text="""here and there. And depending on the exact""" start="00:14:14.760" video="qanda-gc" id="subtitle"]] [[!template text="""situation is your arm at each moment of time,""" start="00:14:17.720" video="qanda-gc" id="subtitle"]] [[!template text="""or as may or may not be able to arrange""" start="00:14:20.240" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: so""" start="00:14:25.160" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: things. So, how the exact the data you cannot""" start="00:14:27.620" video="qanda-gc" id="subtitle"]] [[!template text="""really predict it. It really varies like you""" start="00:14:30.160" video="qanda-gc" id="subtitle"]] [[!template text="""use Windows, you use Linux,""" start="00:14:31.120" video="qanda-gc" id="subtitle"]] [[!template text="""you use like malloc, something else,""" start="00:14:33.240" video="qanda-gc" id="subtitle"]] [[!template text="""but it has nothing to do with Emacs.""" start="00:14:36.260" video="qanda-gc" id="subtitle"]] [[!template text="""It's just something you have to deal with.""" start="00:14:38.040" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Yeah, but my question was in the way that we""" start="00:14:41.780" video="qanda-gc" id="subtitle"]] [[!template text="""are giving the memory back to the operating""" start="00:14:43.460" video="qanda-gc" id="subtitle"]] [[!template text="""system, not just holding it as used and then""" start="00:14:46.020" video="qanda-gc" id="subtitle"]] [[!template text="""to our own memory, like stuff as Emacs that""" start="00:14:49.960" video="qanda-gc" id="subtitle"]] [[!template text="""we do not need to interact with the operating""" start="00:14:51.680" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: Yeah. Emacs does not really hold anything.""" start="00:14:56.040" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: system. That was the question.""" start="00:14:59.160" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: Okay. I was really hoping it does,""" start="00:15:01.920" video="qanda-gc" id="subtitle"]] [[!template text="""but yeah, unfortunately,""" start="00:15:02.760" video="qanda-gc" id="subtitle"]] [[!template text="""because nothing much can be done on Emacs.""" start="00:15:05.640" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Okay. it's not Probably a lot faster if it's""" start="00:15:08.800" video="qanda-gc" id="subtitle"]] [[!template text="""just holding it and when it needs more,""" start="00:15:10.580" video="qanda-gc" id="subtitle"]] [[!template text="""then just get more from the OS.""" start="00:15:12.380" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: There are certain caveats,""" start="00:15:14.220" video="qanda-gc" id="subtitle"]] [[!template text="""for example, there's something called image""" start="00:15:16.720" video="qanda-gc" id="subtitle"]] [[!template text="""cache. And because Emacs stores images in""" start="00:15:20.560" video="qanda-gc" id="subtitle"]] [[!template text="""uncompressed format, it can occupy quite a""" start="00:15:23.720" video="qanda-gc" id="subtitle"]] [[!template text="""lot of memory. In particular,""" start="00:15:25.020" video="qanda-gc" id="subtitle"]] [[!template text="""when you will like view PDFs,""" start="00:15:26.520" video="qanda-gc" id="subtitle"]] [[!template text="""like you open 10, like 20 PDFs in 1 session,""" start="00:15:30.140" video="qanda-gc" id="subtitle"]] [[!template text="""you may have like some image cache blowing""" start="00:15:33.460" video="qanda-gc" id="subtitle"]] [[!template text="""up, But that's not common for people.""" start="00:15:36.720" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: So, guess we are on our time exactly.""" start="00:15:41.420" video="qanda-gc" id="subtitle"]] [[!template text="""So in the next""" start="00:15:43.580" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: I think I was not exactly accurate.""" start="00:15:46.680" video="qanda-gc" id="subtitle"]] [[!template text="""This 1 command, which is,""" start="00:15:49.200" video="qanda-gc" id="subtitle"]] [[!template text="""I think, Nemax 30, is called a malloc trim.""" start="00:15:53.500" video="qanda-gc" id="subtitle"]] [[!template text="""A max malloc trim. It's interactive.""" start="00:15:57.520" video="qanda-gc" id="subtitle"]] [[!template text="""So that can help to release some memory.""" start="00:16:04.080" video="qanda-gc" id="subtitle"]] [[!template text="""I think the way it works is like forces OS to""" start="00:16:08.200" video="qanda-gc" id="subtitle"]] [[!template text="""make use of the released memory.""" start="00:16:12.040" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Okay. That would be like,""" start="00:16:14.960" video="qanda-gc" id="subtitle"]] [[!template text="""we are by the way, switch back to the next""" start="00:16:18.420" video="qanda-gc" id="subtitle"]] [[!template text="""talk. But""" start="00:16:21.420" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: so basically what happens here is that OS may""" start="00:16:24.220" video="qanda-gc" id="subtitle"]] [[!template text="""not release like, even Emacs says,""" start="00:16:27.440" video="qanda-gc" id="subtitle"]] [[!template text="""okay, this memory is free,""" start="00:16:28.740" video="qanda-gc" id="subtitle"]] [[!template text="""depending on the implementation,""" start="00:16:30.060" video="qanda-gc" id="subtitle"]] [[!template text="""I might think, okay, but I still hold that""" start="00:16:32.760" video="qanda-gc" id="subtitle"]] [[!template text="""memory associated with Emacs just in case""" start="00:16:34.860" video="qanda-gc" id="subtitle"]] [[!template text="""Emacs needs more memories,""" start="00:16:35.800" video="qanda-gc" id="subtitle"]] [[!template text="""and I can immediately put the data there""" start="00:16:38.940" video="qanda-gc" id="subtitle"]] [[!template text="""without like more arrangement to allocate""" start="00:16:41.420" video="qanda-gc" id="subtitle"]] [[!template text="""more. And this analog stream basically forces""" start="00:16:45.480" video="qanda-gc" id="subtitle"]] [[!template text="""the OS to release it, like no matter what.""" start="00:16:48.740" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Because most people, when they are using""" start="00:16:52.360" video="qanda-gc" id="subtitle"]] [[!template text="""Emacs, I have the feeling they are only using""" start="00:16:54.320" video="qanda-gc" id="subtitle"]] [[!template text="""Emacs. So it would be kind of interesting if""" start="00:16:56.160" video="qanda-gc" id="subtitle"]] [[!template text="""you just take like, I don't know,""" start="00:16:57.880" video="qanda-gc" id="subtitle"]] [[!template text="""2 gigabytes or something of memory and Emacs""" start="00:17:00.060" video="qanda-gc" id="subtitle"]] [[!template text="""like does what it wants on that and the OS""" start="00:17:02.900" video="qanda-gc" id="subtitle"]] [[!template text="""cannot really take it back.""" start="00:17:04.079" video="qanda-gc" id="subtitle"]] [[!template text="""This was my idea when I""" start="00:17:05.920" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: was So when you see 2 gigabytes in OS,""" start="00:17:08.000" video="qanda-gc" id="subtitle"]] [[!template text="""it doesn't mean that OS cannot take it back.""" start="00:17:10.359" video="qanda-gc" id="subtitle"]] [[!template text="""It may still like allocate certain portion,""" start="00:17:13.859" video="qanda-gc" id="subtitle"]] [[!template text="""even technically free,""" start="00:17:15.640" video="qanda-gc" id="subtitle"]] [[!template text="""but just for future. So this is where Malloc""" start="00:17:20.940" video="qanda-gc" id="subtitle"]] [[!template text="""Dream works. It's like,""" start="00:17:22.339" video="qanda-gc" id="subtitle"]] [[!template text="""it says, yes, OS, I really not going to hold""" start="00:17:25.319" video="qanda-gc" id="subtitle"]] [[!template text="""this for this free memory.""" start="00:17:26.500" video="qanda-gc" id="subtitle"]] [[!template text="""For sure. If you try this MX Malloc Gene,""" start="00:17:31.700" video="qanda-gc" id="subtitle"]] [[!template text="""you will see like a few times to hundreds of""" start="00:17:33.960" video="qanda-gc" id="subtitle"]] [[!template text="""megabytes of read immediately.""" start="00:17:35.200" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: Have a look when I have the time.""" start="00:17:38.560" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: I""" start="00:17:41.480" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 0]: guess if nobody has any questions,""" start="00:17:43.260" video="qanda-gc" id="subtitle"]] [[!template text="""I guess on the pad, there was Nothing else.""" start="00:17:45.660" video="qanda-gc" id="subtitle"]] [[!template text="""I guess we can just close it.""" start="00:17:47.900" video="qanda-gc" id="subtitle"]] [[!template text="""Thanks for the discussion.""" start="00:17:49.140" video="qanda-gc" id="subtitle"]] [[!template text="""Thanks for answering the questions.""" start="00:17:50.640" video="qanda-gc" id="subtitle"]] [[!template text="""[Speaker 1]: Thank you for the great conference.""" start="00:17:56.020" video="qanda-gc" id="subtitle"]] [[!template text="""And yeah, for your volunteer work.""" start="00:17:59.340" video="qanda-gc" id="subtitle"]] [[!template text="""And yeah, for quietly panicking in the""" start="00:18:02.230" video="qanda-gc" id="subtitle"]] [[!template text="""background, right? Yeah,""" start="00:18:02.262" video="qanda-gc" id="subtitle"]] [[!template text="""I mean... You have to be quiet,""" start="00:18:02.337" video="qanda-gc" id="subtitle"]] [[!template text="""you're panicking in the background.""" start="00:18:02.560" video="qanda-gc" id="subtitle"]] Questions or comments? Please e-mail [yantar92@posteo.net](mailto:yantar92@posteo.net?subject=Comment%20for%20EmacsConf%202023%20gc%3A%20emacs-gc-stats%3A%20Does%20garbage%20collection%20actually%20slow%20down%20Emacs%3F) <!-- End of emacsconf-publish-after-page -->