diff --git a/scripts/parse_proto.py b/scripts/parse_proto.py
index <HASH>..<HASH> 100755
--- a/scripts/parse_proto.py
+++ b/scripts/parse_proto.py
@@ -44,6 +44,7 @@ class ProtoMetadata:
   java_api_version = 2
   java_alt_api_package = ''
   outer_class = ''
+  optimize_for = 'SPEED'
 
   def __init__(self):
     self.messages = []
@@ -72,6 +73,10 @@ def MatchOptions(line, data):
   if match:
     data.multiple_files = True if match.group(1).lower() == 'true' else False
 
+  match = re.match(r'option\s+optimize_for\s*=\s*(\S+)\s*;', line)
+  if match:
+    data.optimize_for = match.group(1)
+
 
 def MatchTypes(line, data):
   # messages and enums
Parse and handle the "optimize_for" proto option.