473,323 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

slowness part2

This is a simplified demo of the problem I posted this morning... boiled
down to just the basic case that is causing my app to run painfully slow.
Seems like the slow part is using the graphicsPath Point accessor. Can
anyone see how I could speed this up?

//main test form button handler
private void button1_Click(object sender, System.EventArgs e)
{
System.Drawing.Drawing2D.GraphicsPath gp = new
System.Drawing.Drawing2D.GraphicsPath();
for( int i = 0; i < 2000; i++ )
{
gp.AddLine( i,i, i+2, i );
}

ArrayList list = new ArrayList();
PointF pointF = new PointF( 0,0 );
for ( int i = 0; i < gp.PointCount; i++ )
{
list.Add( gp.PathPoints[i] );

//test.. this is about the speed I would expect
//Point2D p = new Point2D( i,i );
//list.Add( p );
}

int j = 0;//just line so I can put a break point here
}

//---------------------differnt class
class Point2D
{
float m_X, m_Y;

public Point2D( float x, float y )
{
m_X = x;
m_Y = y;
}

public Point2D( PointF p )
{
m_X = p.X;
m_Y = p.Y;
}
}
Nov 16 '05 #1
2 1288
nm, somone pointed out to me I can clone the pointList so I dont have to go
through the nasty Points accessor.. it IS much faster now.

PointF []point = (PointF[])gp.PathPoints.Clone();

"Jason" <Ja***@mobiform.com> wrote in message
news:eM*************@tk2msftngp13.phx.gbl...
This is a simplified demo of the problem I posted this morning... boiled
down to just the basic case that is causing my app to run painfully slow.
Seems like the slow part is using the graphicsPath Point accessor. Can
anyone see how I could speed this up?

//main test form button handler
private void button1_Click(object sender, System.EventArgs e)
{
System.Drawing.Drawing2D.GraphicsPath gp = new
System.Drawing.Drawing2D.GraphicsPath();
for( int i = 0; i < 2000; i++ )
{
gp.AddLine( i,i, i+2, i );
}

ArrayList list = new ArrayList();
PointF pointF = new PointF( 0,0 );
for ( int i = 0; i < gp.PointCount; i++ )
{
list.Add( gp.PathPoints[i] );

//test.. this is about the speed I would expect
//Point2D p = new Point2D( i,i );
//list.Add( p );
}

int j = 0;//just line so I can put a break point here
}

//---------------------differnt class
class Point2D
{
float m_X, m_Y;

public Point2D( float x, float y )
{
m_X = x;
m_Y = y;
}

public Point2D( PointF p )
{
m_X = p.X;
m_Y = p.Y;
}
}

Nov 16 '05 #2
Hi Jason,

Well I'm just guessing, but have you considered the possibility that the
PathPoints property is constructed from scratch *each* time around the loop.
What about just trying list.AddRange(gp.PathPoints)

Cheers

Doug Forster

"Jason" <Ja***@mobiform.com> wrote in message
news:eM*************@tk2msftngp13.phx.gbl...
This is a simplified demo of the problem I posted this morning... boiled
down to just the basic case that is causing my app to run painfully slow.
Seems like the slow part is using the graphicsPath Point accessor. Can
anyone see how I could speed this up?

//main test form button handler
private void button1_Click(object sender, System.EventArgs e)
{
System.Drawing.Drawing2D.GraphicsPath gp = new
System.Drawing.Drawing2D.GraphicsPath();
for( int i = 0; i < 2000; i++ )
{
gp.AddLine( i,i, i+2, i );
}

ArrayList list = new ArrayList();
PointF pointF = new PointF( 0,0 );
for ( int i = 0; i < gp.PointCount; i++ )
{
list.Add( gp.PathPoints[i] );

//test.. this is about the speed I would expect
//Point2D p = new Point2D( i,i );
//list.Add( p );
}

int j = 0;//just line so I can put a break point here
}

//---------------------differnt class
class Point2D
{
float m_X, m_Y;

public Point2D( float x, float y )
{
m_X = x;
m_Y = y;
}

public Point2D( PointF p )
{
m_X = p.X;
m_Y = p.Y;
}
}

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark Dicken | last post by:
Hi All I have found the following Microsoft Technet 'Q' Article :- Q210368 -ACC2000: How to Pass an Array as an Argument to a Procedure (I've also copied and pasted the whole contents into...
0
by: Nicole | last post by:
Has anyone else experienced a dramatic slow down of performance with their ADP's after upgrading to Service Pack 2 or above? The slowness occurs exclusively when pulling data from SQL Server in...
7
by: Mike Nygard | last post by:
I'm experiencing extremely slow response times in design mode of my forms since moving to Access 2003. Simply dragging a button to a different position on the form takes 30 seconds or more. The...
1
by: carverk | last post by:
Hello, Thanks for the Info. Darryl, but have decided to go a different way about this. Here is the following update to the prob: 1. A table called "T_Photos", contains the names of the devices...
1
by: skootr | last post by:
In a very simple learning project, I have a form and a UserControl in the same project. The first time I place the UserControl on the form, it is fine, however, if I make changes to the UserControl,...
0
by: Art | last post by:
Hi, I'm working on an application that writes records to an Access database. What I've got so far works, but very slowly. I have one class that creates the data -- some of it is as follows...
2
by: BerkshireGuy | last post by:
I am using Windows 2000 and Access 2003 and noticed that when I click a control on a report, it takes a few seconds for the "click" to take place. Its laggy. Same with moving controls, adding new...
9
by: allenjo5 | last post by:
Here's a code snippet: i = 0 while (i < 20): i = i + 1 (shellIn, shellOut) = os.popen4("/bin/sh -c ':'") # for testing, the spawned shell does nothing print 'next' # for line in shellOut:...
0
by: =?Utf-8?B?SmFjY2k=?= | last post by:
Hello, I'm having trouble creating a new folder. Right clicking or going to File, New, the arrow turns into an hourglass and for at least a minute, then I can create a new folder. This has been...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.