Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow down on x64 bit mode on Windows #68

Open
bubnenkoff opened this issue May 3, 2017 · 1 comment
Open

Slow down on x64 bit mode on Windows #68

bubnenkoff opened this issue May 3, 2017 · 1 comment

Comments

@bubnenkoff
Copy link

bubnenkoff commented May 3, 2017

App do SELECT queries to PostgreSQL.

				string sql_distance = `SELECT osm_id, ST_DISTANCE(geometry::geography, ST_SetSRID(ST_POINT(37.72308, 55.47957), 4326), true) as dist FROM roads WHERE (SELECT bool_or(ST_Contains(geometry, ST_SetSRID(ST_POINT(37.72308, 55.47957), 4326))) FROM admin) ORDER BY geometry <-> ST_SetSRID(ST_POINT(37.72308, 55.47957), 4326) LIMIT 1;`;

				writef("\nTrack %s. Total Points: %s. Processing", GPSAndSensor.gps, cargpspoints.count);
				Bar b = new Bar();
				b.message = { return "Calc Nearest Road Distance For Every Track Point"; };
				b.start();
				b.max = cargpspoints.count;

				foreach(i, cargpspoint; cargpspoints)
				{
					auto cmd_dist = new PGCommand(pgconnection, sql_distance.replace(`37.72308`, format("%f",cargpspoint.lon)).replace(`55.47957`, format("%f",cargpspoint.lat)));
					auto cmd_nearesPointOnRoad = new PGCommand(pgconnection, sql_nearesPointOnRoad.replace(`37.72308`, format("%f",cargpspoint.lon)).replace(`55.47957`, format("%f",cargpspoint.lat)));

					try
					{					
							auto TotalStartTime = MonoTime.currTime;

						auto nresult = cmd_dist.executeQuery();
						auto nanswer = nresult.array;
						nresult.close();
						if(nanswer.empty)
						{
						//	debug writefln(`%s.%s With Lon: %s Lat: %s outside from polygon "admin"`, config.mysqldbname, GPSAndSensor.gps, cargpspoint.lat, cargpspoint.lon);
							continue;
						}
						nearestroaddistance.id = nanswer.front[0].coerce!ulong;
						nearestroaddistance.distance = nanswer.front[1].coerce!ulong;

						auto TotalEndTime = MonoTime.currTime;
						auto totalDuration = TotalEndTime - TotalStartTime;
						writefln("\n [PG INFO] Calc Time: %s msecs", totalDuration.total!"msecs");
					}
					
					....

If I build it in 32-bit mode (default on Windows) the execution of queries take about 10-12 msecs. If I build it's with dub --arch=x86_64 the query is execution 130-150 msecs.

@bubnenkoff
Copy link
Author

Same problem with ldc2 with release and debug mode.
Only building with dmd show normal speed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant