Skip to content

Instantly share code, notes, and snippets.

@kevingosse
Last active September 26, 2025 11:29
Show Gist options
  • Save kevingosse/eff57610ed6f807b148c3f4b748a1d65 to your computer and use it in GitHub Desktop.
Save kevingosse/eff57610ed6f807b148c3f4b748a1d65 to your computer and use it in GitHub Desktop.
using JetBrains.Rd.Reflection;
namespace ParseHashMap;
public class Program
{
private static int _counter;
static void Main(string[] args)
{
Console.WriteLine("Starting...");
for (int iteration = 0; iteration < 100; iteration++)
{
var proxyGenerator = new ProxyGenerator();
Type[] types =
[
typeof(IInterface1),
typeof(IInterface2),
typeof(IInterface3),
typeof(IInterface4),
typeof(IInterface5),
typeof(IInterface6),
typeof(IInterface7),
typeof(IInterface8),
typeof(IInterface9),
typeof(IInterface10)
];
var threads = new Thread[types.Length];
var barrier = new Barrier(types.Length);
for (int i = 0; i < threads.Length; i++)
{
var interfaceType = types[i];
threads[i] = new Thread(() => CreateProxy(barrier, proxyGenerator, interfaceType));
threads[i].Start();
}
foreach (var thread in threads)
{
thread.Join();
}
Console.WriteLine($"Iteration {iteration} complete.");
}
}
private static void CreateProxy(Barrier barrier, ProxyGenerator proxyGenerator, Type interfaceType)
{
//barrier.SignalAndWait();
_ = proxyGenerator.CreateType(interfaceType);
}
public interface IInterface1
{
string Name { get; }
string Method1(ReturnMe param);
}
public interface IInterface2
{
int Id { get; }
IInterface1 Method2(IInterface1 param);
}
public class ReturnMe
{
}
public interface IInterface3
{
global::System.Guid Key { get; }
IInterface1 Owner { get; }
global::System.DateTime CreatedAt { get; }
IInterface4 LinkWith(IInterface2 other, global::System.Collections.Generic.IEnumerable<ReturnMe> items);
string Describe();
}
public interface IInterface4
{
int Count { get; }
global::System.Collections.Generic.IList<string> Names { get; }
IInterface5 Compute(IInterface3 source, int score);
bool TryAddName(string name);
}
public interface IInterface5
{
decimal Amount { get; }
IInterface6 Next { get; }
bool TryParse(string input, ReturnMe result);
global::System.Collections.Generic.IReadOnlyDictionary<string, string> Metadata { get; }
}
public interface IInterface6
{
global::System.Collections.Generic.IEnumerable<IInterface1> EnumerateOwners();
IInterface7 Merge(IInterface4 other);
void Reset();
}
public interface IInterface7
{
bool IsActive { get; }
IInterface8 Parent { get; }
global::System.Threading.Tasks.Task<IInterface3> LoadAsync(global::System.Threading.CancellationToken ct);
IInterface7 Clone();
}
public interface IInterface8
{
string Code { get; }
global::System.Collections.Generic.IDictionary<string, int> Metrics { get; }
IInterface9 CreateChild(IInterface7 owner, ReturnMe data);
void Invalidate();
}
public interface IInterface9
{
IInterface10 Next { get; }
bool Validate(IInterface8 ctx, char[] input);
int ComputeHash(IInterface3 root);
}
public interface IInterface10
{
double Score { get; }
IInterface12 FinalizeStep(IInterface11 step, int state);
bool TryGetScore(double value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment