Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module main;
- import std.stdio;
- import std.container;
- import std.conv;
- import std.random;
- import std.process;
- import core.memory;
- void pause()
- {
- system("pause");
- }
- void toy()
- {
- Array!(int) store;
- auto minheap = new BinaryHeap!(Array!(int), "a > b")(store);
- auto rng = new Random(unpredictableSeed);
- writeln("inserting...");
- for( uint i = 0 ; i < 100_000 ; i++)
- {
- minheap.insert(uniform(0, 1000, rng));
- }
- writeln("done.");
- writeln("removing");
- while(!minheap.empty)
- {
- minheap.removeFront();
- }
- writeln("done.");
- }
- void main(string[] argv)
- {
- foreach(run; 1..100)
- {
- writeln("Run number ", run);
- toy;
- writeln("collecting...");
- GC.collect();
- writeln("done.");
- if( run == 1 || run == 2) pause;
- }
- pause;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement