Speed Up Algorithm - Sieve Of Eratosthenes - Program Hangs On Really Large Values Of N (try 10 Million)

Aug 17, 2009

I've written an algorithm that I believe to be correct for computing prime numbers up to n with the Sieve of Eratosthenes. Unfortunately, this program hangs on really large values of n (try 10 million). Here is what I've written...

Protected Function Eratosthenes(ByVal n As Integer) As String
Dim maxValue As Integer = Math.Sqrt(n)
Dim values As Generic.List(Of Integer) = New Generic.List(Of Integer)

[code]...

How might I speed this algorithm up? Where are my bottlenecks?

View 12 Replies


ADVERTISEMENT

PhpMyAdmin MySql Database - Program Hangs In The For Loop Before The Variables Are Assigned Values From The Data Table

Jan 5, 2012

I am using vb.net with phpMyAdmin MySql database. While running the piece of code below, the program hangs in the for loop before the variables are assigned values from the data table(dt)...

'Check for appraisal period-----------------------------------------------------------------------
Dim sqlCheckDate As String = "SELECT * FROM tblappraisalsetting where appSetID=(select max(appSetID) from tblappraisalsetting);"

[CODE]................

View 1 Replies

Improve Speed Of Program - User Inputs Min And Max Values

May 3, 2012

I'm currently trying to improve the speed of my program. Basically the user inputs min and max values for a, b, c, and d and a constant n, and then it tries to find the curve/line in the form a (x/b + c) ^ n + d. However for large ranges (1-100 for a,b,c, and d; total of 100 million values to try), it would take around 100 minutes at the current rate (approx 800k values/minute). I'm wondering whether I can further improve the speed. [Code]

View 6 Replies

Any Algorithm To Shorten Very Large Integer?

Dec 8, 2010

I have a function which generates a very large Integer (I do this by using Biginteger from vjslib.dll and I am able to operate all kind of arithmetic operators on such a biginteger.) But, My goal is to shorten this big integer into a small integer. Is there any algorithm? or a mathematical Formula which I can use to represent it in a small integer and use some reverse formula to get the original Big integer?

The big integer my function creates goes like this:
98761210112313489375987956157462364864823458794572 34573485683465868234568613123749081377932457923457 93475897836587236458678234568234658362458762347895 68932456892346578636123846715376123475745723645666 38247687346128346812364812364816341384612384678345 76341236412783461278346781236481263489126348971238 41134681273467812364789

I do not want to represent my bigInteger in a higher base as it will not be possible to do conversion into higher bases with such a large integer.

View 2 Replies

Large Multidimensial Array - Write A Program To Do Markov Chain But States Are Quite Large

Jun 9, 2011

I want to write a program to do Markov chain, but my states are quite large. First of all I calculate all the transition probabilities and revenues for all states(1381860 total states), and store in a multidimensional array. Public RevArr(0 To 9, 0 To 750, 0 To 282) As Long

After that the iteration of markov chain should use these as inputs to calculate the steady-state probabilities. But when I try to run the main code I got this error.Exception of type 'System.OutOfMemoryException' was thrown.

The following is the declaration of second array I add just another dimension for storing all the iterations, but I get this error. Dim stateprob(IT + 1, 0 To 9, 0 To 750, 0 To 282) As single

View 1 Replies

C# - Algorithm To Switch Between RGB And HSB Color Values?

Nov 8, 2010

I read the article Algorithm to Switch Between RGB and HSB Color Values

Type RGBColor
Red As Byte
Green As Byte[code]....

View 6 Replies

Messagebox Hangs Program?

Mar 30, 2009

The messagebox shows properly but will not respond to mouse click and every is halted.. Comment out the messagebox event everything proceeds. No error is generated, things jest stop at themessagebox and willnot proceed. Code as follows:

[code]...

View 2 Replies

Program Hangs On Loop

Jul 25, 2011

my program seems to just freeze whenever I press this button. I need to be able to use this because I'm reading values from a joystick as i'm making a human interface device.

Why is this freezing?[CODE...]

View 3 Replies

Program Hangs For A Few Seconds Before Closing

Mar 23, 2010

When I close my compiled application, it will always hang for a few seconds before closing. It isn't something to do with my PC, I've got a quad core with 4GB of RAM -[code]...

View 4 Replies

Program Hangs When Fonts Are Changed?

Apr 12, 2011

I have a strange problem that I can't seem to find any answers on. I wrote two programs in VB2010. Both work great, install and uninstall no problem and I have done this on 4-5 PC's and laptops, all running Win7. A friend saw them and asked if he could use the programs, but when he installed them neither of them would work. All the prereq's were there and he is also running Win7. For some reason all of a sudden his enlarged font reset itself and VIOLA! both programs started working. I have retested this and it fails/works every time.

So my question is, how do I fix this or is it fixable? Is there somewhere in VB where this has to be set to be 'flexible'??

View 8 Replies

VS 2010 Program Hangs In Vista?

Aug 4, 2010

I have a heavily timer tick driven application that seems to randomly just stop on vista/w7 while minimized, sometimes it goes on for hours sometimes just minutes but the end result is same just stops for no apparent reason, the moment i unminimize it it keeps going. This never happens on xp tho where it works perfectly so what might be the problem?

View 1 Replies

Graph In VB - Returns Two Values Temperature And Speed

Jan 22, 2012

I have just finished working on my database, basically it returns two values temperature and speed. i want to plot a graph of temperature against speed, with data from a database. also the data is not in order, would i need to order the data before it can be inputted into a graph.

View 19 Replies

Program Hangs When Closing Serial Port?

Feb 15, 2009

I have a VB.Net 2008 app that I have converted from VB6 which reads data from a weight scale connected to a serial port. I am able to read the received data and display it on the screen, but when I go to Stop the reading and attempt to close the serial port, the app hangs.

Private Delegate Sub ShowWeight(ByVal tWeight As String)
Private Sub comScale_DataReceived(ByVal sender As Object, ByVal e
As System.IO.Ports.SerialDataReceivedEventArgs) Handles

[Code]....

View 10 Replies

Serial Program Hangs After Short Time

Sep 9, 2011

I'm writing a simple program to retrieve data via the Serial Port. I have a piece of hardware that returns its 14 byte status every time vbCr is written to it. The program works fine except after a few hundred requests the program begins to hang, off and on. Some times for a second some times for longer. I need to update every 25 milliseconds so the hanging sets in quickly. This faster the interval the quicker the problem sets in but no mater how long the interval the problem eventually starts.[code]...

View 8 Replies

VS 2010 Program Hangs On Client Computers?

May 5, 2011

I've created a multithreaded application that copies data from one directory to another, and I'm having trouble getting it to work properly on clients' computers. All computers running the software have Windows 7 and the .NET Framework 4.0 Client Profile installed, which is what I've compiled the program for. I have two threads: one does the actual copying, and the other updates the UI on the program. Whenever I run the program on my computer, even if I'm copying 45 GB, for example, it runs fine. However, if I run it on another computer, it will sometimes freeze the entire computer, so then I have to manually shut the computer down in order to use it again. I have been trying to find out why this occurs, but I cannot. Does anyone think he/she can provide me with some ideas as to why this happens and how I can prevent it from occurring?

View 4 Replies

Acrobat Hangs After User Manually Exits Program

Jun 4, 2012

I'm currently having an issue with VB.Net and Adobe Acrobat. The issue comes from exiting Acrobat but the Windows Taskbar still states that there is an Acrobat.exe process open. I have tried using Marshal.ReleaseComObject(), but it still hangs there. I do not want to have to rely on the "End Process" option on the Task bar in order to remove it.

Below is a snippet of the code that I am try to using:
Try
'Tries To Close Acrobat Application
acrobatApp.Exit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(javaScriptObj)
[Code] .....

Although I am not sure if this could be a problem - I run a javascript saveAs script on the Acrobat side in order to make a copy of the file. This also could be a reason why it is hanging, but I ruled it out based on basic knowledge of saving files and exiting from other Acrobat/Microsoft Programs. Acrobat only closes when my application ends. (Currently) I am trying to make it consider the case if a user manually closes the Acrobat application.

View 1 Replies

Program Hangs During Debugging At A Breakpont Set At A Subroutine Call

Jul 5, 2009

My program hangs during debugging at a breakpont set at a subroutine call. It hangs on breakpoints anywhere inside the subroutine also. But does not hang otherwise at other locations where I have set breakpoints.

[Code]...

View 4 Replies

Algorithm To Set Expired Sofware For 1 Year Program?

Jan 17, 2010

I want to set software expired in vb.net in term 1 year.

View 4 Replies

Program Hangs After Leaving Screen Saver Or Locking Computer?

Nov 15, 2011

Our program works fine, until someone locks the computer or the screen-saver pops up (but not ctrl+alt+delete). Once the computer is unlocked/the screen saver is closed, the application stops drawing everything except the title bar, and stops responding to input - it displays a mostly-white window which can't be moved or closed.(Example of application freezing - the mountains are from my desktop background)If we let it sit for about 5~10 minutes, it comes back to life, and doesn't hang again (even after locking the computer/screen saver popup) until the application is restarted.

View 9 Replies

Find Same Value In A Million Records?

Jul 19, 2011

I need a query that would allow me to find/search same STK_HOLD_NAME and/or STK_HOLD_CODE in my record/database . I dont how to query it because my table_STK has a million of records.

Im using MS SQL SERVER 2008 R2.

View 3 Replies

398 Million Prime Numbers And Growing?

Aug 17, 2011

[URL]

Each set of ( 1 million ) prime numbers is in a ZIP file just click on say 1st Million

on the left to download a list as a ZIP file.

Here is a similar page which is a lot easier on the eyes:>>

[URL]

These are of course great to use in any security application or as part of any password.

However with the list so readily available on the internet is it such a good idea to use a prime number as part of a password? Food for thought perhaps? ....

I guess it depends on how long it is too. :-)

You could try to remember one that is close to an important date or other number that you know maybe?

If you are more paranoid use more than one prime number in a password with other characters ( UPPER and lower case letters etc ).

[URL]

View 1 Replies

A String Of 5 Million Characters To Be Substringed?

Jun 2, 2012

I'm creating a book reader, and the book is about 5 million characters. This book contains a lot of chapters, and what my program does is that if I asked for Chapter 2, it would go to the first index of where it says (Chapter 2), and it would delete everything behind it using substring(0, indexof(Chapter 2)). And everything after the Chapter.

I've written the code which is about 4 lines not anything more. The original text file book is in the resources. I've set a string = the resource. I tried then searching for Chapter 1, it worked. It worked until about Chapter 7, then it stopped working for the all the Chapters after it.

I thought that Substring cannot search into that huge number of characters. So i cut down the book into another part from Chapter 7 to Chapter something, and like that. And it was of 8 parts at last. Set each one as a resource and set a string = resource. It would search in the first part, to the last part until it finds it.

However, I noticed later that when I tried searching for Chapters 5 or 6, it stopped working! Chapter 7 is working. The last chapters in each part are not working anymore.All I could think of that it is a memory problem, not a substring problem. What can I do?

View 3 Replies

VS 2010 Generate Primes Over 100 Million?

Jun 27, 2010

I salvaged the following piece of code from:[URL]...This code works fine, but the problem comes when I need to get all the primes above 100 million. I am familar (at least a little bit) with the BigInteger class in .NET 4.0, but when I replace all the instances of "Integer" with "BigInteger" in the following code I get this error: Value of type 'System.Collections.Generic.List(Of System.Numerics.BigInteger)' cannot be converted to 'System.Collections.Generic.List(Of Integer)'.

(The reason I need primes above 100 million is that I'm trying to work through some projects on www.projecteuler.net)Anyone have some ideas on how to modify the code to work with BigIntegers,

[Code]...

View 2 Replies

Best Speed Up Running Of My Program?

Sep 5, 2011

How do I best speed up running of my program?Once I have simplified code as much as possible, made it smaller. By using loops were appropriate etc.

View 7 Replies

Best Speed Up Running Of Program?

Sep 5, 2011

How do I best speed up running of my prog?Once I have simplified code as much as possible, made it smaller. By using loops were appropriate etc.

View 1 Replies

Streamwriter - Replacing Specific Values In A Large Text File

Jun 4, 2011

I have some large csv files (1.5gb each) where I need to replace specific values. The method I'm currently using is terribly slow and I'm fairly certain that there should be a way to speed this up but I'm just not experienced enough to know what I should be doing. This is my first post and I tried searching through to find something relevant but didn't come across anything.

My other thought would be to break the file into chunks so that I can read the entire thing into memory, do all of the replacements there and then output to a consolidated file. I tried this but the way I did it actually ended up seeming slower than my current method.

Sub Main()
Dim fName As String = "2009.csv"
Dim wrtFile As String = "2009.1.csv"

[Code]....

View 1 Replies

Make A Program To Test A Speed Of Mac?

Feb 10, 2012

are there any way we can make a program to test a speed of mac even if you are not using it?

like for instance
64:16:F0:003:9A

how can i test this without using it?

View 1 Replies

Program Logic To Speed Up Processing?

Oct 11, 2009

I have setup an application to parse about 3000 files a day where each contains around 4000-5000 posts in xml format with like 100 fields.It involves a lot of cleanup and parsing but on average it takes around 6 seconds per post.Now I tried threading but because of the way I have everything set up with variables being overwritten etc...I have divided the files into different folders and just created copies of the program to run and access the assigned folder. It is running on a windows 2008 server with 16 G of memory and I am told I need to reprogram to speed up the process and also not use so much memory.

For i As Integer = 0 To fileLists.Count - 1
Do
Try

[code].....

View 2 Replies

VS 2010 How To Find Program Speed

Apr 4, 2012

Are there any ways to make my program more accurate or faster? So far, I've been using multithreading and priorities.

View 28 Replies

Check Internet Speed - Download A File Like 1mb Size, Then It Will Calculate The Speed?

Feb 21, 2012

How do i exactly check internet connection speed.I have searched around google and found out a method w/c will Download a file like 1mb size, then it will calculate the speed.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved