Monday, 4 February 2008

Haha, holy crap

The SQL Server datalayer is so much faster than the Access one. I don't know why this surprises me, but offline testing shows that player movement is now instantaneous. I figured the big bottleneck would be the speed of the webservice, but maybe I was wrong!

Anyway, the webservice now has two datalayers (one for Access, one for SQL Server). The active datalayer is changed with a simple AppSetting in web.config.

I didn't have to alter the SQL queries too much between Access and SQL Server. The obvious one was exchanging Now() for GETDATE(), and the only other change was with the DateAdd() function. Access accepts only a character for the datepart argument, where seconds are 's' and minutes are 'n'. SQL Server doesn't accept a character, but what looks to be a constant. Here's the result:

DateAdd SQL Function
Access: DateAdd('s', -30, Now())
SQL Server: DateAdd(second, -30, GETDATE())

Both examples return the current date/time minus 30 seconds. Which, if you're wondering, is how I SELECT recent chats in the game.

I'm half tempted to install SQL Express on the test server to see how much of a difference the SQL layer makes online.

Update: Yup, the online test server is now running at warp-speed. Thanks, SQL Server!

No comments: