What exactly are you trying to do? It sounds like you want to do something specific, but you are asking too direct of a question. What is your ultimate goal? What have you tried already?
I assume you are using Magento 1.x...
Stock is one of those areas that is affected by caching, and has a lot of side effects. Trying to go around the Magento design can cause a lot of unexpected problems INCLUDING modifying the stock in the database (cataloginventory_stock_item table).
The most straight forward method I have found to modify stock or stock related attributes is via the API:
You don't need to use the API. Use the code that is written there as an example on how to implement your functionality in your extension.
NOTE: the stock API is still expensive (average 1 second per product) because it requires a full product save in order to trigger all of the indexes/caches. There is an optimization possible if you only want to adjust the inventory amount but not its stock status (is_salable). For example, if you need to update the inventory from 1500 to 1395, and it doesn't affect the ability to sell that item... you can optimize the code to update the Catalog Stock Item data directly.