07-17-2014 11:54 PM
@altenbach wrote:
@altenbach wrote:
In a few tens of seconds it solves 1G where the result is 24739512092254535.Finally tested on a modern I7 and it finds and adds all primes below 1'000'000'000 (1G) in well under 10 seconds. 😄
Some speed tests here, I'm pretty impressed at how fast that code runs.
10=375.23us sum=17
100=7.85us sum=1060
1 000=15.09us sum=76127
10 000=30.79us sum=5736396
100 000=272.89us sum=454396537
1 000 000=2.80ms sum=37550402023 (finally took longer than 1ms)
10 000 000=28.73ms sum=3203324994356
100 000 000=495.18ms sum=279209790387276
1 000 000 000=5.99s sum= 24739512092254535 (longer than 1s)
1 500 000 000=9.01s
1 600 000 000=9.44s
1 690 000 000=10.09s
1 700 000 000=10.16s
1 750 000 000=10.45s
2 147 483 647=12.97s sum=109930813984377205 (longer than 10s)
07-17-2014 11:57 PM - edited 07-17-2014 11:59 PM
@altenbach wrote:
@altenbach wrote:
In a few tens of seconds it solves 1G where the result is 24739512092254535.Finally tested on a modern I7 and it finds and adds all primes below 1'000'000'000 (1G) in well under 10 seconds. 😄
I got between 5 and 6 seconds for my 1G run here. I'm pretty impressed at how fast your code runs. (and up to 2,147,483,647 in 13ish seconds)
07-18-2014 01:56 AM
There is still a little slack left. You should replace the "<0" with a "<=0" inside the small case structure.
Are you using LabVIEW 64bit? I get an "out of memory error" if I go above 1G on 32bit LabVIEW.
07-19-2014 03:05 AM
@altenbach wrote:
There is still a little slack left. You should replace the "<0" with a "<=0" inside the small case structure.
Are you using LabVIEW 64bit? I get an "out of memory error" if I go above 1G on 32bit LabVIEW.
Yes. LabVIEW 64bit. Good for things like this, but likes to spontaneously crash when I close it.
I'll give your tweak a shot when I get in on monday.
08-15-2014 02:09 PM
Time for the thread revival:
Saw this today... not sure what the person was thinking.
"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books
08-15-2014 02:11 PM
@bsvare wrote:
Time for the thread revival:
Saw this today... not sure what the person was thinking.
Always love a thread revival.
That can't be what the person wants it to do. I'm sure they intend on this being a VIG. Still the If == True is a classic.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
08-15-2014 02:34 PM
@bsvare wrote:
Saw this today... not sure what the person was thinking.
You should always post a link to the original thread.
There are many things wrong here:
08-15-2014 02:54 PM
@altenbach wrote:
@bsvare wrote:
Saw this today... not sure what the person was thinking.
You should always post a link to the original thread.
There are many things wrong here:
- the "equal true" of course.
- the fact that the loop only runs once, so the shift register will never exceed 1. The value could be obtained from "boolean to 0,1" of the subVI output and eliminating the upper half of the code..
- ...
There's no link because there's no thread. It was something I saw in person today.To be nice to the person who wrote it, I wasn't going to give them credit.
But the code is suppose to be an "Init once" routine.
"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books
08-15-2014 03:31 PM
@bsvare wrote:
But the code is suppose to be an "Init once" routine.
It is called "First Call?". See, I did it all in one node.
09-17-2014 06:02 PM - edited 09-17-2014 06:02 PM
Try to simplify this while loop 😄 😮
(It is important to know that the "array" indicator gets reset to default upstream somewhere in an earlier frame of a long flat sequence.)