Skip to main content

Posts

Showing posts with the label function call

Function call performance optimizations

On my last post about that subject , I wrote about some optimizations I did to get better performance when calling functions with Npgsql. While that optimizations were very nice, they had a drawback: you had to reuse your NpgsqlCommand object. You had to reuse it because the optimizations were based on cached data and if you created a new NpgsqlCommand object the data would need to be cached again. In the general case, where you would create many NpgsqlCommand objects and call functions with them, you would not benefit from those optimizations. In order to fix that, Noah Misch created a patch which remove 2 of the 3 internal calls which were giving performance problems. The only case left is for functions which have return type of 'record'. We are working to get this case also covered. I'm going to show here how much performance improvement you get with this patch with a simple call to a function which returns an integer. This function is on Npgsql unit test suite, but I ...