6 ms·
The issue with intelligent pooling is that you (a) might end up with a lot of bookkeeping, or (b) people will forget to return things to the pool. It's way easi
by tlipcon 17y ago
The issue with intelligent pooling is that you (a) might end up with a lot of bookkeeping, or (b) people will forget to return things to the pool. It's way easier to do that kind of design in C++ where you can use scope and copy constructors to automatically refcount and then return back.
NullWritable is pretty useful sometimes, but what's wrong with Counter objects for counters?
- jganetsk 17y agoHere's an example of improving the design of your interfaces to improve the problem... The mapper function now receives two extra arguments, one Writable of key type and one Writable of value type. The emit method now has zero arguments. When called, it emits the key-value pair represented by the Writables passed in to the mapper function. Now, you are forced to use and reuse the Writable objects passed in to your mapper. Sure, you can allocate new ones, but they would be worthless since you can't do anything with them. This would, hopefully, stop programmers from allocating them. No need to explicitly return things to any pools.