A nightmare if looked at by a performance standpoint, but it gets the job done,
        at least for now.

        Checks everything against everything and handles all collision reactions.
978701
def run_brute(self):
        
        global collidable_objects
        if self.collision_depth == self.SHALLOW_DEPTH:
            for obj in collidable_objects:
                collision = self.query_collision(obj)
                if collision is not None:
                    #Execute the reactions for both of the colliding objects.
                    obj.collision_response(collision)
                    collision.collision_response(obj)
        elif self.collision_depth == self.DEEP_DEPTH:
            for obj in collidable_objects:
                collisions = self.query_all_collisions(obj)
                for collision in collisions:
                    #Execute the reactions for both of the colliding objects.
                    obj.collision_response(collision)
                    collision.collision_response(obj)
376496
private void applyConstraints()
    {
        final Map<Tile, Collection<CollisionFormula>> toRemove = new HashMap<>();
        for (int v = 0; v < map.getInTileHeight(); v++)
        {
            for (int h = 0; h < map.getInTileWidth(); h++)
            {
                final Tile tile = map.getTile(h, v);
                if (tile != null)
                {
                    final TileCollision tileCollision = tile.getFeature(TileCollision.class);
                    toRemove.put(tile, checkConstraints(tileCollision, h, v));
                }
            }
        }
        for (final Entry<Tile, Collection<CollisionFormula>> current : toRemove.entrySet())
        {
            final Tile tile = current.getKey();
            final TileCollision tileCollision = tile.getFeature(TileCollision.class);
            for (final CollisionFormula formula : current.getValue())
            {
                tileCollision.removeCollisionFormula(formula);
            }
        }
    }
488818
protected void handlePurgeCache() {
        reportable.output("Purging all resources from the cache");

        try {
            cacheMgrService.purgeResources();
        } catch (Exception e) {
            reportable.error("Unable to remove all resources in the cache");
            reportable.error("Reason: " + e.getMessage());
            bail(GENERAL_FAILURE);
        }
    }
974122
def query_collision(collision_object):
        
        global collidable_objects
        # Note that we use a Brute Force approach for the time being.
        # It performs horribly under heavy loads, but it meets
        # our needs for the time being.
        for obj in collidable_objects:
            # Make sure we don't check ourself against ourself.
            if obj.obj_id is not collision_object.obj_id:
                if collision_object.is_colliding(obj):
                    # A collision has been detected. Return the object that we are colliding with.
                    return obj

        # No collision was noticed. Return None.
        return None
964259
protected void reportCachePerformance ()
    {
        if (/* Log.getLevel() != Log.log.DEBUG || */
            _improv == null ||
            _cacheStatThrottle.throttleOp()) {
            return;
        }

        // compute our estimated memory usage
        long amem = 0;
        int asize = 0;
        synchronized (_atiles) {
            // first total up the active tiles
            Iterator<SoftReference<Tile>> iter = _atiles.values().iterator();
            while (iter.hasNext()) {
                SoftReference<Tile> sref = iter.next();
                Tile tile = sref.get();
                if (tile != null) {
                    asize++;
                    amem += tile.getEstimatedMemoryUsage();
                }
            }
        }
        log.info("Tile caches", "amem", (amem / 1024) + "k",
            "tmem", (Tile._totalTileMemory / 1024) + "k", "seen", _atiles.size(), "asize", + asize);
    }
832810
def check_player_collision(self):
        """"""
        player_tiles = r.TileMapManager.active_map.grab_collisions(self.char.coords)
        enemy_tiles = r.TileMapManager.active_map.grab_collisions(self.coords)

        #Check to see if any of the tiles are the same. If so, there is a collision.
        for ptile in player_tiles:
            for etile in enemy_tiles:
                if r.TileMapManager.active_map.pixels_to_tiles(ptile.coords) == r.TileMapManager.active_map.pixels_to_tiles(etile.coords):
                    return True

        return False
385349
def handleStatus(self, version, status, message):
        """"""

        self.status = status
        self.message = message
705732
function (dt) {

        if (me.input.isKeyPressed("left")) {
            // update the entity velocity
            this.body.vel.x -= this.body.accel.x * me.timer.tick;
        } else if (me.input.isKeyPressed("right")) {
            // update the entity velocity
            this.body.vel.x += this.body.accel.x * me.timer.tick;
        } else {
            this.body.vel.x = 0;
        }
        if (me.input.isKeyPressed("up")) {
            // update the entity velocity
            this.body.vel.y -= this.body.accel.y * me.timer.tick;
        } else if (me.input.isKeyPressed("down")) {
            // update the entity velocity
            this.body.vel.y += this.body.accel.y * me.timer.tick;
        } else {
            this.body.vel.y = 0;
        }

        // apply physics to the body (this moves the entity)
        this.body.update(dt);

        // handle collisions against other shapes
        me.collision.check(this);

        // check if we moved (an "idle" animation would definitely be cleaner)
        if (this.body.vel.x !== 0 || this.body.vel.y !== 0) {
            this._super(me.Entity, "update", [dt]);
            return true;
        }
    }
507867
function benchmark( b ) {
		var i;

		b.tic();
		for ( i = 0; i < b.iterations; i++ ) {
			// TODO: synchronous task
			if ( TODO/* TODO: condition */ ) {
				b.fail( 'something went wrong' );
			}
		}
		b.toc();
		if ( TODO/* TODO: condition */ ) {
			b.fail( 'something went wrong' );
		}
		b.pass( 'benchmark finished' );
		b.end();
	}
207468
public function performAllChecks() {
    $this->checkRequire();
    $this->checkBltRequireDev();
    if (!$this->getInspector()->isVmCli()) {
      $this->checkPrestissimo();
    }
    $this->checkComposerConfig();

    return $this->problems;
  }
10115
private synchronized void ensureIsRun() {
        if (!isRun) {
            isRun = true;
            try {
                result = executeProc(args);
                exception = null;
            } catch (ProcError e) {
                throw e.asRuntimeException();
            } catch (Throwable t) {
                exception = t;
                result = null;
            }
        }
    }
388754
def state_check_collisions( state_engine, nameop, history_id_key, block_id, checked_ops, collision_checker ):
    

    # verify no collisions against already-accepted names
    collision_check = getattr( state_engine, collision_checker, None )
    try:
        assert collision_check is not None, "Collision-checker '%s' not defined" % collision_checker
        assert hasattr( collision_check, "__call__" ), "Collision-checker '%s' is not callable" % collision_checker
        assert history_id_key in nameop.keys(), "History ID key '%s' not in name operation" % (history_id_key)
        assert 'op' in nameop.keys(), "BUG: no op in nameop"
    except Exception, e:
        log.exception(e)
        log.error("FATAL: incorrect state_create() decorator")
        sys.exit(1)

    rc = collision_check( nameop[history_id_key], block_id, checked_ops )
    return rc
923342
private boolean handleDrag() {
        if (!isAnimationRunning()) {
            if (dragHelper.hasThresholdBeenReached()) {
                int margin = Math.round(isMaximized() ? dragHelper.getDragDistance() :
                        initialMargin + dragHelper.getDragDistance());
                margin = Math.max(Math.max(margin, minMargin), 0);
                setTopMargin(margin);
            }

            return true;
        }

        return false;
    }
1112777
public function process()
    {
        if (!$this->isInitialized()) {
            $this->init();
        }

        if ($this->getFirstAncestor('SwatForm') !== null) {
            $this->getCompositeWidget('check_all')->process();
        }

        $this->processed = true;

        if ($this->tile !== null) {
            $this->tile->process();
        }
    }
215921
def benchmark():
    
    # Use all cores but one on multi-core CPUs.
    pool_size = multiprocessing.cpu_count() - 1
    if pool_size < 1:
        pool_size = 1

    # Start a pool of workers. Only allow 1 task per child, to force flushing
    # of solver's internal caches.
    pool = multiprocessing.Pool(processes=pool_size, maxtasksperchild=1)
    results = pool.imap_unordered(run_scenario, Benchmark.scenarii)
    pool.close()
    pool.join()

    # Update CSV database with the new results.
    benchmark = Benchmark()
    benchmark.load_csv()
    benchmark.add(results)
    benchmark.save_csv()
1242148
protected void reportCachePerformance ()
    {
        if (/* Log.getLevel() != Log.log.DEBUG || */
            _cacheStatThrottle.throttleOp()) {
            return;
        }

        // compute our estimated memory usage
        long size = 0;

        int[] eff = null;
        synchronized (_ccache) {
            Iterator<CacheRecord> iter = _ccache.values().iterator();
            while (iter.hasNext()) {
                size += iter.next().getEstimatedMemoryUsage();
            }
            eff = _ccache.getTrackedEffectiveness();
        }
        log.info("ImageManager LRU", "mem", ((size / 1024) + "k"), "size", _ccache.size(),
            "hits", eff[0], "misses", eff[1], "totalKeys", _keySet.size());
    }
1310323
void performOptimizations() {
    checkState(options.shouldOptimize());
    List<PassFactory> optimizations = getPassConfig().getOptimizations();
    if (optimizations.isEmpty()) {
      return;
    }

    phaseOptimizer = createPhaseOptimizer();
    phaseOptimizer.consume(optimizations);
    phaseOptimizer.process(externsRoot, jsRoot);
    phaseOptimizer = null;
  }