Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization - Reusing Antlr4ResultHandler Initialization #1107

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion drivers/python/age/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from antlr4.tree.Tree import *
from decimal import Decimal

resultHandler = None

class ResultHandler:
def parse(ageData):
pass
Expand All @@ -34,7 +36,9 @@ def parseAgeValue(value, cursor=None):
if value is None:
return None

resultHandler = Antlr4ResultHandler(None)
global resultHandler
if (resultHandler == None):
resultHandler = Antlr4ResultHandler(None)
try:
return resultHandler.parse(value)
except Exception as ex:
Expand Down