[gnome-builder] vala-pack: create ValaIndex lazily
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vala-pack: create ValaIndex lazily
- Date: Thu, 25 Jan 2018 06:48:39 +0000 (UTC)
commit 71f59b6b708f15150bff8831ba1cd6b84edf64b3
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 24 22:46:01 2018 -0800
vala-pack: create ValaIndex lazily
We don't want to do this work until something has requested
access to vala code-insight. Otherwise, the ValaCodeContext
creates some ~30,000 structures which are just unnecessary.
It saves some 20mb of resident upon opening a project.
src/plugins/vala-pack/ide-vala-service.vala | 33 +++++++++++++++++------------
1 file changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/src/plugins/vala-pack/ide-vala-service.vala b/src/plugins/vala-pack/ide-vala-service.vala
index 40b528f90..1ed406d61 100644
--- a/src/plugins/vala-pack/ide-vala-service.vala
+++ b/src/plugins/vala-pack/ide-vala-service.vala
@@ -26,29 +26,34 @@ namespace Ide
{
Ide.ValaIndex _index;
- public ValaIndex index {
- get { return this._index; }
- }
-
public unowned string get_name () {
return typeof (Ide.ValaService).name ();
}
- public void start () {
- this._index = new Ide.ValaIndex (this.get_context ());
+ public ValaIndex index {
+ get {
+ if (this._index == null) {
+ this._index = new Ide.ValaIndex (this.get_context ());
- Ide.ThreadPool.push (Ide.ThreadPoolKind.INDEXER, () => {
- Ide.Vcs vcs = this.get_context ().get_vcs ();
- var files = new ArrayList<GLib.File> ();
+ Ide.ThreadPool.push (Ide.ThreadPoolKind.INDEXER, () => {
+ Ide.Vcs vcs = this.get_context ().get_vcs ();
+ var files = new ArrayList<GLib.File> ();
- load_directory (vcs.get_working_directory (), null, files);
+ load_directory (vcs.get_working_directory (), null, files);
- if (files.size > 0) {
- this._index.add_files.begin (files, null, () => {
- debug ("Vala files registered");
+ if (files.size > 0) {
+ this._index.add_files.begin (files, null, () => {
+ debug ("Vala files registered");
+ });
+ }
});
}
- });
+
+ return this._index;
+ }
+ }
+
+ public void start () {
}
public void stop () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]