2
0
Эх сурвалжийг харах

[server] GC task: allow more display requests, less dms_full_typing requests

Rudy Ges 6 сар өмнө
parent
commit
8404990c0d

+ 4 - 3
src/compiler/server.ml

@@ -850,7 +850,7 @@ and wait_loop verbose accept =
 	let sctx = ServerCompilationContext.create verbose in
 	let cs = sctx.cs in
 	enable_cache_mode sctx;
-	let ring = Ring.create 10 0. in
+	let ring = Ring.create 100 None in
 	let gc_heap_stats () =
 		let stats = Gc.quick_stat() in
 		stats.major_words,stats.heap_words
@@ -861,11 +861,12 @@ and wait_loop verbose accept =
 		let heap_stats_now = gc_heap_stats() in
 		let words_allocated = (fst heap_stats_now) -. (fst !heap_stats_start) in
 		let heap_size = float_of_int (snd heap_stats_now) in
-		Ring.push ring words_allocated;
+		Ring.push ring (Some words_allocated);
+		if sctx.was_compilation then for _ = 1 to 20 do Ring.push ring None done;
 		if Ring.is_filled ring then begin
 			Ring.reset_filled ring;
 			 (* Maximum working memory for the last X compilations. *)
-			let max = Ring.fold ring 0. (fun m i -> if i > m then i else m) in
+			let max = Ring.fold ring 0. (fun m v -> match v with None -> m | Some i -> if i > m then i else m) in
 			cs#add_task (new Tasks.gc_task max heap_size)
 		end;
 		heap_stats_start := heap_stats_now;