Commit 63af26b3 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Speed up [printaod] by using a static buffer.

parent a08a0df2
......@@ -499,25 +499,29 @@ module Symbol = struct
print a dot at this offset, if we find it. Note that [dot] can be
equal to [length]. *)
let buffer =
Buffer.create 1024
let printaod offset dot symbols =
let b = Buffer.create 512 in
let length = Array.length symbols in
let first = ref true in
let separate () =
if not !first then Printf.bprintf b " ";
if not !first then Printf.bprintf buffer " ";
first := false
for i = offset to length do
if i = dot then begin
Printf.bprintf b "."
Printf.bprintf buffer "."
if i < length then begin
Printf.bprintf b "%s" (print symbols.(i))
Printf.bprintf buffer "%s" (print symbols.(i))
Buffer.contents b
let s = Buffer.contents buffer in
Buffer.clear buffer;
let printao offset symbols =
printaod offset (-1) symbols
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment