mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-19 18:59:18 +00:00
Speed up documentation generation by reducing amount of disk IO (cache directory contents in memory).
This commit is contained in:
parent
d352aed114
commit
357be0e67a
|
@ -731,25 +731,31 @@ namespace Bind.GL2
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cache the last doc processor to avoid processing the same file again and again
|
||||||
|
static DocProcessor processor = new DocProcessor(Path.Combine(Settings.DocPath, Settings.DocFile));
|
||||||
|
static Dictionary<string, string> docfiles;
|
||||||
private static void WriteDocumentation(BindStreamWriter sw, Function f)
|
private static void WriteDocumentation(BindStreamWriter sw, Function f)
|
||||||
{
|
{
|
||||||
try
|
if (docfiles == null)
|
||||||
{
|
{
|
||||||
string path = Path.Combine(Settings.DocPath, Settings.FunctionPrefix + f.WrappedDelegate.Name + ".xml");
|
docfiles = new Dictionary<string, string>();
|
||||||
if (!File.Exists(path))
|
foreach (string file in Directory.GetFiles(Settings.DocPath))
|
||||||
path = Path.Combine(Settings.DocPath, Settings.FunctionPrefix +
|
|
||||||
f.TrimmedName + ".xml");
|
|
||||||
|
|
||||||
if (!File.Exists(path))
|
|
||||||
path = Path.Combine(Settings.DocPath, Settings.FunctionPrefix + f.TrimmedName.TrimEnd(numbers) + ".xml");
|
|
||||||
|
|
||||||
if (File.Exists(path))
|
|
||||||
{
|
{
|
||||||
DocProcessor doc_processor = new DocProcessor(Path.Combine(Settings.DocPath, Settings.DocFile));
|
docfiles.Add(Path.GetFileName(file), file);
|
||||||
sw.WriteLine(doc_processor.ProcessFile(path));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
try
|
||||||
|
{
|
||||||
|
string file = Settings.FunctionPrefix + f.WrappedDelegate.Name + ".xml";
|
||||||
|
if (!docfiles.ContainsKey(file))
|
||||||
|
file = Settings.FunctionPrefix + f.TrimmedName + ".xml";
|
||||||
|
if (!docfiles.ContainsKey(file))
|
||||||
|
file = Settings.FunctionPrefix + f.TrimmedName.TrimEnd(numbers) + ".xml";
|
||||||
|
|
||||||
|
if (docfiles.ContainsKey(file))
|
||||||
|
sw.WriteLine(processor.ProcessFile(docfiles[file]));
|
||||||
|
}
|
||||||
|
catch
|
||||||
{ }
|
{ }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue