Page 7 of 8

User feedback Mr. sitmo's prng

Posted: December 19th, 2013, 8:02 am
by Cuchulainn
The .NET crypto is 10 times slower than Random. And that's the way it is. Compare it to a Rolls Royce and not a light-weight Ferrari.

User feedback Mr. sitmo's prng

Posted: December 19th, 2013, 10:41 am
by Cuchulainn
QuoteOriginally posted by: outrunYes, but my point was different:.NET crypto: 1hr 42 min.NET random: 12 minC++: 50 secThat performance penalty would make .NET useless for real world MC engines.What do you think about the difference between the last two lines? It's done on different compilers and machines. Is that what one expects?Yes, we agree that native .NET engines are not suitable for production MC (I was kind of expecting this conclusion).Here's a good test: how long does it take to compute 10 bln rns using your prng _but_ calling it from C# (via CLI of course). Since we are talking in-proces I reckon it will be not bad?In that case ... you can announce prng to the .NET world

User feedback Mr. sitmo's prng

Posted: December 19th, 2013, 10:52 am
by Cuchulainn
QuoteOriginally posted by: outrunThat would be a great test!, and also C++ random() vs .NET random()I'll see if I can do some test on my machine tonight, factoring out machine differences.I would expect that .NET would offload calls like rng to optimized binaries instead of interpreting bytecode (I have no clue how it works actually)ThanksIf you can set up the test code in C++ (easy !) I will test it also myself in 1. C++2. C++/CLI (mixed mode)3. C# via a DLL2A. .NET Random in C++/CLI3A. .NET Random in C#(reckon 2A ~ 3A)btw see your e-mail.

User feedback Mr. sitmo's prng

Posted: December 19th, 2013, 11:50 am
by Cuchulainn
Plan B (step 4, 4A)Quote[T]here are situations where access to pointer types becomes a necessity. For example, interfacing with the underlying operating system, accessing a memory-mapped device, or implementing a time-critical algorithm may not be possible or practical without access to pointers. To address this need, C# provides the ability to write unsafe code. 9780321741769 709 [1]

User feedback Mr. sitmo's prng

Posted: December 19th, 2013, 7:15 pm
by Cuchulainn
Just to recapulate1. C++2. C++/CLI (mixed mode)3. C# via a DLL2A. .NET Random in C++/CLI3A. .NET Random in C#(reckon 2A ~ 3A)4. Unsafe option CLI4A. Unsafe option C# GOAL: Ideally, one of 2,2A,3A, 4, 4A as fast as 1 then Bingo => you can do it for any library But 1st for prng!BTW do you have the test program for 1? No hurry.

User feedback Mr. sitmo's prng

Posted: December 23rd, 2013, 6:36 pm
by Cuchulainn
Delegate-based RNG (no inheritance)BTW a delegate type is awful similar to std::function!

User feedback Mr. sitmo's prng

Posted: December 24th, 2013, 8:30 am
by Cuchulainn
When I run Polar with Sitmo prng I get something like 5.833 instead of ~ 5.842 as in Polar + .NET Random. Has it got t do with your NextDouble()?Any ideas?(?)BTW did you get the gist of the delegate concept in the C# code example?

User feedback Mr. sitmo's prng

Posted: December 24th, 2013, 9:44 am
by Cuchulainn
QuoteI don't get the delegate:See the example again Mon Dec 23, 13 08:36 PM rand()