Skip to content

Commit

Permalink
Exit early if the file is smaller than the final Chunk size.
Browse files Browse the repository at this point in the history
  • Loading branch information
nbp committed Mar 18, 2016
1 parent 2003269 commit 9d08d1e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lithium/lithium.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def minimize():

if chunkStart >= len(parts):
writeTestcaseTemp("did-round-" + str(chunkSize), True);
last = (chunkSize == finalChunkSize)
last = (chunkSize <= finalChunkSize)
empty = (len(parts) == 0)
print ""
if not empty and anyChunksRemoved and (minimizeRepeat == "always" or (minimizeRepeat == "last" and last)):
Expand Down Expand Up @@ -451,7 +451,7 @@ def minimizeSurroundingPairs():
while 1:
anyChunksRemoved = tryRemovingSurroundingChunks(chunkSize);

last = (chunkSize == finalChunkSize)
last = (chunkSize <= finalChunkSize)

if anyChunksRemoved and (minimizeRepeat == "always" or (minimizeRepeat == "last" and last)):
# Repeat with the same chunk size
Expand Down Expand Up @@ -599,7 +599,7 @@ def minimizeBalancedPairs():
while 1:
anyChunksRemoved = tryRemovingBalancedPairs(chunkSize);

last = (chunkSize == finalChunkSize)
last = (chunkSize <= finalChunkSize)

if anyChunksRemoved and (minimizeRepeat == "always" or (minimizeRepeat == "last" and last)):
# Repeat with the same chunk size
Expand Down Expand Up @@ -865,7 +865,7 @@ def replacePropertiesByGlobals():
numRemovedChars = tryMakingGlobals(chunkSize, numChars);
numChars -= numRemovedChars

last = (chunkSize == finalChunkSize)
last = (chunkSize <= finalChunkSize)

if numRemovedChars and (minimizeRepeat == "always" or (minimizeRepeat == "last" and last)):
# Repeat with the same chunk size
Expand Down

0 comments on commit 9d08d1e

Please sign in to comment.