SERVING THE QUANTITATIVE FINANCE COMMUNITY

  • 1
  • 4
  • 5
  • 6
  • 7
  • 8
 
User avatar
Cuchulainn
Topic Author
Posts: 60513
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 19th, 2013, 8:02 am

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.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Topic Author
Posts: 60513
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 19th, 2013, 10:41 am

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
Last edited by Cuchulainn on December 18th, 2013, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Topic Author
Posts: 60513
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 19th, 2013, 10:52 am

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.
Last edited by Cuchulainn on December 18th, 2013, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Topic Author
Posts: 60513
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 19th, 2013, 11:50 am

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]
Last edited by Cuchulainn on December 18th, 2013, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Topic Author
Posts: 60513
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 19th, 2013, 7:15 pm

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.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Topic Author
Posts: 60513
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 23rd, 2013, 6:36 pm

Delegate-based RNG (no inheritance)BTW a delegate type is awful similar to std::function!
Last edited by Cuchulainn on December 22nd, 2013, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Topic Author
Posts: 60513
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 24th, 2013, 8:30 am

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?
Last edited by Cuchulainn on December 23rd, 2013, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
 
User avatar
Cuchulainn
Topic Author
Posts: 60513
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

User feedback Mr. sitmo's prng

December 24th, 2013, 9:44 am

QuoteI don't get the delegate:See the example again Mon Dec 23, 13 08:36 PM rand()
Last edited by Cuchulainn on December 23rd, 2013, 11:00 pm, edited 1 time in total.
http://www.datasimfinancial.com
http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..
R. van Gulik
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On