Any way to speed up Python and Pygame?

Use Psyco, for python2: import psyco psyco.full() Also, enable doublebuffering. For example: from pygame.locals import * flags = FULLSCREEN | DOUBLEBUF screen = pygame.display.set_mode(resolution, flags, bpp) You could also turn off alpha if you don’t need it: screen.set_alpha(None) Instead of flipping the entire screen every time, keep track of the changed areas and only update … Read more

Android xml vs java layouts performance

A layout defines the visual structure for a user interface, such as the UI for an activity or app widget. You can declare a layout in two ways: Declare UI elements in XML. Android provides a straightforward XML vocabulary that corresponds to the View classes and subclasses, such as those for widgets and layouts. Instantiate … Read more

Avoiding denormal values in C++

Wait. Before you do anything, do you actually know that your code is encountering denormal values, and that they’re having a measurable performance impact? Assuming you know that, do you know if the algorithm(s) that you’re using is stable if denormal support is turned off? Getting the wrong answer 10x faster is not usually a … Read more

Static vs. non-static method

As defined, power is stateless and has no side effects on any enclosing class so it should be declared static. This article from MSDN goes into some of the performance differences of non-static versus static. The call is about four times faster than instantiating and calling, but it really only matters in a tight loop … Read more

Any way to SQLBulkCopy “insert or update if exists”?

I published a nuget package (SqlBulkTools) to solve this problem. Here’s a code example that would achieve a bulk upsert. var bulk = new BulkOperations(); var books = GetBooks(); using (TransactionScope trans = new TransactionScope()) { using (SqlConnection conn = new SqlConnection(ConfigurationManager .ConnectionStrings[“SqlBulkToolsTest”].ConnectionString)) { bulk.Setup<Book>() .ForCollection(books) .WithTable(“Books”) .AddAllColumns() .BulkInsertOrUpdate() .MatchTargetOn(x => x.ISBN) .Commit(conn); } trans.Complete(); … Read more