com.io7m.jpuddle 0.4.0 Documentation
Package Information
Orientation
Overview
The com.io7m.jpuddle package implements
a very simple object pooling system.
Rationale
Object pooling is a programming technique
where instead of creating new objects to service requests, a small
pool of objects is created and the objects within the pool are reused
repeatedly to service requests instead. This was traditionally used
by Java programs as a performance optimization in an attempt to
reduce memory allocations and therefore reduce the amount of
garbage collection that occurs. On modern
Java virtual machines, however, object pooling
as a means to improve performance in this manner is strongly
contraindicated: Object allocations are extremely fast (on the order
of a few tens of nanoseconds), escape analysis
often eliminates allocations entirely, and modern garbage collectors
are optimized to make short-lived objects essentially free.
With this in mind, it may not be clear why the
com.io7m.jpuddle package
should exist at all! The answer is that object pooling is still
useful when the objects represent external resources that may be
very expensive to acquire and/or the program should avoid acquiring
too many of these resources at any given time. An example of this
sort of use case is allocating short-lived framebuffer objects
on a GPU. Graphics memory is typically in relatively short supply
and creating an object on the GPU is generally considered to be
an expensive and slow process (relative to simply allocating an
object on the CPU side). A pool of framebuffer objects
can be created that the application can reuse repeatedly without
needing to create new objects, and the size of the pool can be
bounded so that the application does not try to exceed the available
GPU memory.
Installation
Source compilation
The project can be compiled and installed with
Maven:
Maven
Regular releases are made to the
Central Repository,
so it's possible to use the
com.io7m.jpuddle
package in your projects with the following Maven dependency:
<dependency>
<groupId>com.io7m.jpuddle</groupId>
<artifactId>com.io7m.jpuddle-core</artifactId>
<version>0.4.0</version>
</dependency>
All
io7m.com
packages use Semantic Versioning
, which implies that it is always safe to use version ranges
with an exclusive upper bound equal to the next major version - the API of
the package will not change in a backwards-incompatible manner before the
next major version.
Platform Specific Issues
There are currently no known platform-specific issues.
License
All files distributed with the
com.io7m.jpuddle
package are placed under the following license:
Copyright © 2015 <code@io7m.com> http://io7m.com
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
API Reference
Javadoc
API documentation for the package is provided via the
included
Javadoc.